mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-22 02:06:48 +00:00
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:
1 parent
d08805f1a6
commit
b766aa4d16
30 files changed
+1323
-322
No files matched your search
+2
-2
@@ -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)
|
||||
Reference in new issue
Block a user