mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Basic support for impl virtual override keyword (#2493)
Features:
* Add basic support for `impl` virtual methods (override virtual method)
* Error on invalid declaration for `impl` and `virtual`, covering simple use cases
* Add `abstract` fn parser-only support
Changes:
* Modify parser to handle new function specifiers, resolve conflicts
* Group `virtual_override` and `FN`, and group `impl_kind` and `IMPL` to avoid ambiguities with around `impl` token parsing
* Add new `VirtualOverride` enum for function declarations, and matching `virt_override() -> VirtualOverride` getter
* Update function declaration logic
Depends on #2462
This commit is contained in:
+1
-2
@@ -25,8 +25,7 @@ base class C {
|
||||
}
|
||||
|
||||
class D extends C {
|
||||
// TODO: This should instead use `impl` when supported
|
||||
virtual fn Foo[self: Self]() -> i32 {
|
||||
impl fn Foo[self: Self]() -> i32 {
|
||||
return 3;
|
||||
}
|
||||
fn Bar[self: Self]() -> i32 {
|
||||
|
||||
Reference in New Issue
Block a user