mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 10:11:04 +01:00
Initial implementation of unformed state for local variables. (#1387)
Allows unformed state for local variables. Reports a run-time error when an unformed local variable is used. - Added declaration without initialization for local variables in the parser. - Made the init expression of VariableDefinition optional. - Expanded (alive, dead) to (uninitialized, alive, dead) in the Heap. Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
04cfcc1dc2
commit
52ee050019
@@ -14,7 +14,7 @@ fn Main() -> i32 {
|
||||
// Error: can't use keyword `Self` as the name of a variable.
|
||||
// TODO: Current error message is unclear, better would be to say
|
||||
// something like: unexpected `Self`, expecting identifier
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/basic_syntax/fail_var_named_self.carbon:[[@LINE+1]]: syntax error, unexpected COLON, expecting EQUAL
|
||||
// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/basic_syntax/fail_var_named_self.carbon:[[@LINE+1]]: syntax error, unexpected COLON, expecting EQUAL or SEMICOLON
|
||||
var Self : i32 = 0;
|
||||
return Self;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user