fix: stabilize v0.14 compiler and CI gates#66
Merged
Conversation
…notations
The token-walking transformer in `TransformSource` only entered the
parameter-list context when it saw `func name(` or `func(`. For methods
with a receiver, e.g. `func (r *T) Foo(x: int)`, the second `(` is
preceded by `IDENT RPAREN`, which the previous logic treated as an
arbitrary parenthesised expression. As a result the `:` in `x: int` was
never converted into a space and the generated Go was invalid.
Detect the receiver form by walking backwards from the param list `(`
through a matching `RPAREN ... LPAREN` group with depth tracking, then
checking that `FUNC` sits immediately before the receiver's `(`. The
walk bails on `;`, `{` or `}` so unrelated parenthesised expressions
preceding a function call are not misclassified.
Added `pkg/ast/transform_test.go` with four cases (pointer receiver,
value receiver + multiple params, body struct literal colons preserved,
generic receiver type). Each parses the transformer output with
`go/parser` so the assertion is exactly the property we care about:
valid Go on the way out. Without this fix all four cases fail because
the surviving `:` makes go/parser reject the param list.
Add ENUM and GUARD to two complementary tokenizer tests: - `TestTokenIsKeyword` checks the `IsKeyword()` predicate that classifies a `TokenKind` once it already exists. - `TestTokenizeIdentifiers` drives the full scanner over a source buffer and asserts the resulting `TokenKind` values, so it covers the keyword-lookup map that maps identifier text -> kind. These surfaces are independent: removing `"enum"`/`"guard"` from the keyword map in `tokenizer.go` only breaks `TestTokenizeIdentifiers`, because `IsKeyword()` works on the `TokenKind` itself. Covering both catches regressions in either direction.
…ant field types The enum parser's parseTypeExpr accepted any number of '*' prefixes, but only a single trailing '[]', and only in the order `<pointers><slice><name>`. Field declarations such as `[]*Foo`, `[][]Foo`, or `[][]*Foo` therefore tripped the parser, which surfaced downstream as a confusing "parse error: ... expected declaration, found enum" message at the enum's opening line. Replace the two ad-hoc loops with a single loop that consumes '*' and '[]' tokens in any order and any count, matching what the rest of the pipeline already accepts for ordinary field types. Tests cover plain, pointer (*T, **T), slice ([]T, [][]T), mixed (*[]T, []*T, [][]*T), generic slice ([]int) prefixes for both struct-style and tuple-style variants, plus end-to-end regressions through TransformSource for the previously failing `[]*Name` and multi-line variant bodies.
- recover lambda types across dgo call chains and range variables - preserve grouped var composite literals during tuple scanning - honor --no-mascot for interactive transpile commands - wrap unresolved MustErr returns with the enclosing Result type - clear staticcheck failures and add regression coverage
📊 Performance Benchmark ReportPerformance Benchmark ReportAnalyzed 190 benchmark(s)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stabilizes the v0.14 line and restores the full CI path.
dgocalls and range variablesvarcomposite literals during tuple scanning (closes BUG: var() group fails to parse with composite literal #63)dingo go --no-mascoton interactive terminals (closes BUG: --no-mascot doesn't work from TTY #64)Resultwrapping for unresolvedMustErr()receiversPR #62 is intentionally deferred because it adds a new plugin validation lifecycle and belongs in a feature release rather than this stabilization patch.
Verification
go test ./...--no-mascotverified in a real PTY