mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 21:51:12 +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
@@ -46,11 +46,11 @@ import Cpp library "abstract.h";
|
||||
|
||||
class C {
|
||||
extend base: Cpp.A;
|
||||
// CHECK:STDERR: fail_todo_impl_abstract_member.carbon:[[@LINE+4]]:3: error: impl without compatible virtual in base class [ImplWithoutVirtualInBase]
|
||||
// CHECK:STDERR: impl fn f[addr self: Self*]() {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR: fail_todo_impl_abstract_member.carbon:[[@LINE+4]]:3: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase]
|
||||
// CHECK:STDERR: override fn f[addr self: Self*]() {}
|
||||
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// CHECK:STDERR:
|
||||
impl fn f[addr self: Self*]() {}
|
||||
override fn f[addr self: Self*]() {}
|
||||
}
|
||||
|
||||
// --- abstract_final.h
|
||||
|
||||
Reference in New Issue
Block a user