mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 11:08:31 +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
@@ -74,7 +74,10 @@ auto HandleFunctionSignatureFinish(Context& context) -> void {
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::EqualGreater: {
|
||||
context.AddFunctionDefinitionStart(context.Consume(), state.has_error);
|
||||
context.AddFunctionTerseDefinitionStart(context.Consume(),
|
||||
state.has_error);
|
||||
// Any error is recorded on the FunctionTerseDefinitionStart.
|
||||
state.has_error = false;
|
||||
context.PushState(state, StateKind::FunctionTerseBodyFinish);
|
||||
context.PushStateForExpr(PrecedenceGroup::ForTopLevelExpr());
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user