Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions cmd/cli/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@ func prepareInstallContext() (*installContext, error) {
}, nil
}

func installAllDependencies() error {
ctx, err := prepareInstallContext()
if err != nil {
return err
}
return installManifestDependencies(ctx)
}

func installManifestDependencies(ctx *installContext) error {
if len(ctx.file.Dependencies) == 0 {
printInfo("No dependencies to install")
Expand Down
16 changes: 8 additions & 8 deletions cmd/cli/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ build = "lib"
}
}()

if err := installAllDependencies(); err != nil {
t.Fatalf("installAllDependencies: %v", err)
if err := GetCommand(nil); err != nil {
t.Fatalf("GetCommand: %v", err)
}
if _, err := os.Stat(filepath.Join(versionedModule, manifest.FileName)); err != nil {
t.Fatalf("expected restored versioned cache: %v", err)
Expand Down Expand Up @@ -105,7 +105,7 @@ mock_path = "./mock"
mustWriteGetTest(t, filepath.Join(cachePackage, "src", "pkg.peep"), "unlocked-cache")
chdirForTest(t, root)

if err := installAllDependencies(); err != nil {
if err := GetCommand(nil); err != nil {
t.Fatal(err)
}
lock, err := manifest.LoadLockfile(root)
Expand All @@ -127,7 +127,7 @@ mock_path = "./mock"
if err := os.Rename(mockPackage, offlineMock); err != nil {
t.Fatal(err)
}
if err := installAllDependencies(); err != nil {
if err := GetCommand(nil); err != nil {
t.Fatalf("valid cache triggered refetch: %v", err)
}
if err := os.Rename(offlineMock, mockPackage); err != nil {
Expand All @@ -138,7 +138,7 @@ mock_path = "./mock"
if err := os.WriteFile(cacheSource, []byte("tampered"), 0o644); err != nil {
t.Fatal(err)
}
if err := installAllDependencies(); err != nil {
if err := GetCommand(nil); err != nil {
t.Fatalf("tampered cache was not repaired: %v", err)
}
if data, err := os.ReadFile(cacheSource); err != nil || string(data) != "original" {
Expand All @@ -155,7 +155,7 @@ mock_path = "./mock"
if err != nil {
t.Fatal(err)
}
if err := installAllDependencies(); err == nil || !strings.Contains(err.Error(), "checksum") {
if err := GetCommand(nil); err == nil || !strings.Contains(err.Error(), "checksum") {
t.Fatalf("moved tag error = %v", err)
}
lockAfter, err := os.ReadFile(filepath.Join(root, manifest.LockfileName))
Expand Down Expand Up @@ -191,7 +191,7 @@ child = "github.com/acme/child"
mustWriteGetTest(t, filepath.Join(root, "mock", "acme", "child-v1.0.0", manifest.FileName), "name = \"child\"\nbuild = \"lib\"\n")
chdirForTest(t, root)

if err := installAllDependencies(); err != nil {
if err := GetCommand(nil); err != nil {
t.Fatal(err)
}
lock, err := manifest.LoadLockfile(root)
Expand Down Expand Up @@ -307,7 +307,7 @@ mock_path = "./mock"
}
chdirForTest(t, root)

err = installAllDependencies()
err = GetCommand(nil)
if test.wantError {
if err == nil {
t.Fatal("legacy migration succeeded")
Expand Down
4 changes: 0 additions & 4 deletions cmd/cli/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ func printInfo(text string) {
fmt.Printf("ℹ %s\n", text)
}

func printWarning(text string) {
fmt.Printf("⚠ %s\n", text)
}

func printError(text string) {
fmt.Printf("✗ %s\n", text)
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/cli/ui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ func TestUIPrinters(t *testing.T) {
printHeader("Header")
printSuccess("ok")
printInfo("info")
printWarning("warn")
printError("err")
printUpdate("upd")
printPackage("pkg", "1.0.0")
Expand All @@ -42,7 +41,7 @@ func TestUIPrinters(t *testing.T) {
printCached()
printTransitive("dep", "2.0.0")
})
for _, part := range []string{"Header", "ok", "info", "warn", "err", "upd", "pkg @1.0.0", "dim", "dl", "cached", "dep@2.0.0"} {
for _, part := range []string{"Header", "ok", "info", "err", "upd", "pkg @1.0.0", "dim", "dl", "cached", "dep@2.0.0"} {
if !strings.Contains(out, part) {
t.Fatalf("missing %q in output: %q", part, out)
}
Expand Down
4 changes: 2 additions & 2 deletions docs/architecture/cli-and-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ registry tests check unique names, aliases, arity contracts, and help output.
`cmd/cli` owns user-facing dependency operations. It uses `manifest` for
project state, `registry` for package content and versions, `remotes` for host
validation, and `semver` for constraints. `ui.go` is a thin stdout vocabulary:
`printHeader`, `printSuccess`, `printInfo`, `printWarning`, `printError`,
`printHeader`, `printSuccess`, `printInfo`, `printError`,
`printUpdate`, `printPackage`, `printDim`, `printDownload`, `printCached`, and
`printTransitive`.

Expand Down Expand Up @@ -205,7 +205,7 @@ validator; `StripProviderPrefix` returns the provider-local path when valid.
rule to CLI and LSP. `Load` parses package metadata, compiler constraint,
build type, neighbor/remote dependencies, and optional mock-remote settings.
`ValidatePackageName` and `ParseDependency` own package/dependency validation.
`Save` and `RemoveDependency` serialize manifest state.
`Save` serializes manifest state.
- `lockfile.go`: `LockfileEntry` stores version, resolved URL, checksum, direct
bit, description, dependency edges, reverse `UsedBy`, and timestamp.
`Lockfile` stores schema, alias-to-package `DirectDeps`, package entries, and
Expand Down
6 changes: 3 additions & 3 deletions docs/architecture/frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ precede `.`. Whitespace and ordinary comments are skipped.
- `numberHandler` emits `NUMBER` without numeric interpretation.
- `docHandler` emits `DOC_COMMENT`; it removes the `///` prefix and trims the
remaining text. Normal `//` and `/* ... */` comments are discarded.
- `stringHandler` and `cstringHandler` remove delimiters, decode escapes, and
emit `STRING` or `CSTRING`.
- `stringHandler` removes delimiters, decodes escapes, and emits `STRING` or
`CSTRING`.
- `charHandler` decodes a single-quoted value and requires exactly one valid
UTF-8 rune.
- `byteCharHandler` decodes a `b'...'` value and requires exactly one byte.
Expand Down Expand Up @@ -156,7 +156,7 @@ ranges must retain the same one-based convention.
### Shared state: `parser/parser.go`

`Parser` stores the file path, token stream, diagnostic bag, current token index,
next AST node ID, and a context stack. `New` receives
and next AST node ID. `New` receives
the already-tokenized stream; the lexer is not called by the parser.

`current`, `next`, and `prev` inspect the stream without advancing. `advance`
Expand Down
24 changes: 5 additions & 19 deletions docs/architecture/semantics-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ This map records binding, type, place, intrinsic, and constant implementation ob
wins and shadowing is lexical.
- `Symbols` preserves declaration order; declaration identity comes from the binding result rather than scanning symbol AST pointers.
- `IsMutableBinding` combines lookup, kind, and `Symbol.IsMutable`.
- `Parent` supports bounded analyses such as `place.LocalRoot`.
- `Parent` supports bounded scope walks.

## Symbol index

Expand Down Expand Up @@ -167,8 +167,7 @@ be discarded. Backing maps remain private.
- Functions with parameters are added to `OperationFunctions`.
- `bindModuleBinding` binds an explicit source type through `TypeFromSyntax`.
- Missing top-level types retain `UnknownType` for later inference/recovery.
- `moduleScopeSymbol`, `bindModuleScopeType`, and
`bindModuleScopeTypeIfUnset` centralize module-local symbol access and writes.
- `moduleScopeSymbol` centralizes module-local symbol access.

### Named type binding

Expand Down Expand Up @@ -393,29 +392,16 @@ are `types.go`, `syntax.go`, `relations.go`, `compatibility.go`, `lookup.go`,
- `Project` recognizes one selector or non-slicing index projection.
- `Decompose` returns root expression and projections in source order.
- Slices are not independently addressable places; range indexes become wildcard
origin projections in `Resolve`.
origin projections.
- `Addressable` answers whether an identifier or projection names addressable
storage, including pointer/reference bases.
- `MutableAddressable` preserves binding permission through value and owning-pointer
projections. Mutable references grant referent access; shared-reference restrictions
survive subsequent safe projections. It also reports shared reference targets and
the mutable binding required by the access, for diagnostics and usage tracking.
- `LocalRoot` finds a caller-local root below module scope and stops at pointer
indirection.
- `Binding` carries a symbol and a transient `Local` flag.
- `BindingResolver` supplies symbols for identifiers injected into cloned defaults.
- Expanded defaults use `Local=false`; declaration-module storage must not become a
caller pointer-escape source.
- `Resolve` is the canonical place walk and returns storage origins, value origins,
dependencies, and stability.
- Identifiers start with a symbol root.
- Selectors append field projections.
- Constant indexes append stable index projections.
- Integral identifier indexes append binding-index projections and dependencies.
- Unknown indexes and range indexes append wildcard projections.
- Owned pointers append pointee projections for the projected base.
- Proven variant cases append variant-payload projections.
- Reference and raw-pointer value origins can be normalized through callbacks.
- `Resolution` carries storage origins, value origins, dependencies, and
stability; flow analysis over THIR builds it.
- `OriginsOverlap` is conservative; concrete different fields/fixed indexes prove
disjointness, while prefixes, wildcards, and symbolic indexes may overlap.

Expand Down
Loading
Loading