Skip to content

Parser void return completion and qualified type fixtures#29

Merged
wolfy-j merged 13 commits intomainfrom
fix/fixture-gap-reduction
Apr 4, 2026
Merged

Parser void return completion and qualified type fixtures#29
wolfy-j merged 13 commits intomainfrom
fix/fixture-gap-reduction

Conversation

@wolfy-j
Copy link
Copy Markdown
Contributor

@wolfy-j wolfy-j commented Apr 4, 2026

Summary

  • Complete parser coverage for void return () in all function type forms
  • Use qualified type references (module.Type) in all realworld fixtures
  • typed-callback-chain: 29 → 6 errors
  • Total fixture gap: 72 → 49

Parser changes

Add missing grammar rules for parenthesized and fun keyword function types with void return:

  • ((params) -> ()) — needed for optional callbacks like ((x: T) -> ())?
  • (() -> ()) — parenthesized empty params
  • fun(params): () and fun(): () — fun keyword void return

Comprehensive test TestParseVoidReturnAllForms covers 20 forms.

Fixture changes

All cross-module type references now use qualified names (status.Response instead of bare Response). The checker's type resolver supports this through manifest lookup.

Test plan

  • go test -count=1 ./... — all packages pass
  • go vet ./... — clean
  • 0/10 stability runs
  • Parser test covers bare, parenthesized, and fun keyword forms

wolfy-j added 13 commits April 3, 2026 21:02
Replace bare cross-module type names with module.TypeName in all type
annotation positions. The checker's type resolver supports qualified
type references through manifest lookup.

result-type-narrowing left with bare names — qualified result.Result
causes regression due to generic instantiation interaction.
Add missing grammar rules for parenthesized function types with void
return and fun keyword with void return. Covers all combinations:

- ((params) -> ()) — parenthesized with named params, void return
- (() -> ()) — parenthesized empty params, void return
- fun(params): () — fun keyword with void return
- fun(): () — fun keyword empty with void return

These are needed for optional callback patterns like ((x: T) -> ())?
used in StreamCallbacks and similar real-world types.

Comprehensive test TestParseVoidReturnAllForms covers 20 forms across
bare arrow, parenthesized, and fun keyword variants.

Impact: typed-callback-chain fixture 29 → 6 errors.
Total fixture gap: 72 → 49.
- lookup-table-cast: fix invalid field annotation syntax, use typed
  locals instead. 11 -> 0 errors.
- typed-callback-chain: replace {any} events with proper discriminated
  union StreamEvent type. Checker narrows event fields through type
  guards. 6 -> 1 error (remaining: array literal vs union element).
- typed-callback-chain types.lua: construct empty_result with typed
  intermediates to satisfy named type matching.

Total fixture gap: 49 -> 33.
The registry.call() returns (any?, string?). Accessing result.output
produces any, which correctly cannot be assigned to string without a
cast. Removed the incorrect string annotation — the correct pattern
is to leave the type inferred as any or use an explicit cast.

2 remaining errors are real type system gaps: return literal record
with nested map field doesn't match named type through quasi-invariant
check.

Total fixture gap: 33 -> 31.
@wolfy-j
Copy link
Copy Markdown
Contributor Author

wolfy-j commented Apr 4, 2026

  • 400 tests FYI

@wolfy-j wolfy-j merged commit 7d9d116 into main Apr 4, 2026
@wolfy-j wolfy-j deleted the fix/fixture-gap-reduction branch April 9, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant