Support for terse => function bodies (#7895)

Treat the function as having a `-> auto` return type. Reject calls to
functions that still have a non-deduced `-> auto` return type, and
rewrite the function to have the actual return type once it is known.

Assisted-by: Gemini via Antigravity
This commit is contained in:
Richard Smith authored and GitHub committed 2026-10-16 21:48:48 +00:00
1 parent d08805f1a6
commit b766aa4d16
30 files changed
+1323 -322

No files matched your search

+2 -2
View File
@@ -85,9 +85,9 @@ var b: auto = fn (x: i32 = 0) => x;
// CHECK:STDOUT: │ │ │ │ ├─IntLiteral '0'
// CHECK:STDOUT: │ │ │ ├─DefaultValuePattern '='
// CHECK:STDOUT: │ │ ├─ExplicitParamList ')'
// CHECK:STDOUT: │ │ ╭─LambdaDefinitionStart '=>'
// CHECK:STDOUT: │ │ ╭─LambdaTerseDefinitionStart '=>'
// CHECK:STDOUT: │ │ ├─IdentifierNameExpr 'x'
// CHECK:STDOUT: │ ├─Lambda 'fn'
// CHECK:STDOUT: │ ├─LambdaTerseDefinition 'fn'
// CHECK:STDOUT: ├─VariableDecl ';'
// CHECK:STDOUT: ├─FileEnd ''
// CHECK:STDOUT: (root)