mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Replace impl fn with override fn (#6008)
This proposal renames the syntax used to mark an overriding definition of a virtual method from `impl fn` to `override fn` to avoid ambiguity: besides indicating an overriding virtual function, it can be parsed as an "impl" declaration when the construct following "impl" begins with a lambda introduced by "fn". Closes #5711 --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
973d721916
commit
f4bd6e42f9
@@ -22,11 +22,11 @@ fn F() {
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
// CHECK:STDERR:
|
||||
default fn F();
|
||||
// CHECK:STDERR: fail_virtual.carbon:[[@LINE+4]]:3: error: `impl` not allowed; requires class scope [ModifierRequiresClass]
|
||||
// CHECK:STDERR: impl fn G();
|
||||
// CHECK:STDERR: ^~~~
|
||||
// CHECK:STDERR: fail_virtual.carbon:[[@LINE+4]]:3: error: `override` not allowed; requires class scope [ModifierRequiresClass]
|
||||
// CHECK:STDERR: override fn G();
|
||||
// CHECK:STDERR: ^~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
impl fn G();
|
||||
override fn G();
|
||||
// CHECK:STDERR: fail_virtual.carbon:[[@LINE+4]]:3: error: `virtual` not allowed; requires class scope [ModifierRequiresClass]
|
||||
// CHECK:STDERR: virtual fn H();
|
||||
// CHECK:STDERR: ^~~~~~~
|
||||
|
||||
Reference in New Issue
Block a user