mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Parse vars in classes the same as vars in other locations (#7188)
Class vars are still restricted to simple `name: type` bindings, not full patterns. This is now handled in the check phase instead of during parsing. This is in preparation for supporting `static var`.
This commit is contained in:
+2
-6
@@ -72,13 +72,9 @@ let (x: {}, y: {}) = ({}, {});
|
||||
library "[[@TEST_NAME]]";
|
||||
|
||||
class C {
|
||||
// CHECK:STDERR: fail_in_class.carbon:[[@LINE+8]]:7: error: expected identifier in field declaration [ExpectedFieldIdentifier]
|
||||
// CHECK:STDERR: fail_in_class.carbon:[[@LINE+4]]:20: error: found tuple pattern in class `var` decl [FieldWithTuplePattern]
|
||||
// CHECK:STDERR: var (x: {}, y: {});
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
// CHECK:STDERR: fail_in_class.carbon:[[@LINE+4]]:3: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
|
||||
// CHECK:STDERR: var (x: {}, y: {});
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: ^
|
||||
// CHECK:STDERR:
|
||||
var (x: {}, y: {});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user