Skip to content

Fix parser: void return type with named params in record fields#27

Merged
wolfy-j merged 1 commit intomainfrom
fix/table-builder-type-tracking
Apr 3, 2026
Merged

Fix parser: void return type with named params in record fields#27
wolfy-j merged 1 commit intomainfrom
fix/table-builder-type-tracking

Conversation

@wolfy-j
Copy link
Copy Markdown
Contributor

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

Summary

  • Add missing grammar rule '(' funcparamlist ')' TArrow '(' ')' for void-returning methods in record type annotations
  • The parser handled () -> () but rejected (self: T) -> (), causing cascading type errors in any record with void-returning methods

Impact

One rule addition, 45 type system errors eliminated across real-world fixtures:

Fixture Before After
factory-constructor 6 0
iterator-pipeline 11 0
module-with-generics 5 0
service-locator 14 0
generic-registry 12 4
metatable-oop 5 4
Total 117 72

Test plan

  • New parser test TestParseVoidReturnInRecordField with 5 cases
  • go test ./compiler/parse/... passes
  • go test ./... — all 96 packages pass, zero regressions
  • Real-world fixtures updated to reflect improvements

…elds

Add missing grammar rule for (params) -> () in function type expressions.
The parser handled () -> () but not (self: T) -> () or (a: number) -> (),
causing parse errors in record field type annotations with void-returning
methods.

One new rule in parser.go.y:
  '(' funcparamlist ')' TArrow '(' ')' → FunctionTypeExpr with empty Returns

Impact on real-world fixture scorecard (117 → 72 tracked errors):
- factory-constructor:    6 → 0 (fixed)
- iterator-pipeline:     11 → 0 (fixed)
- module-with-generics:   5 → 0 (fixed)
- service-locator:       14 → 0 (fixed)
- generic-registry:      12 → 4
- metatable-oop:          5 → 4
@wolfy-j wolfy-j merged commit 8bff60b into main Apr 3, 2026
@wolfy-j wolfy-j deleted the fix/table-builder-type-tracking 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