This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
Failing type-check for abstract getters #21
Open
Description
I have an abstract base-class with an abstract, generic getter named value
.
class Foo<T> {
def value T
}
I extend this into a generic class with a generic private field _value
and a constructor - but when I try to implement the value
getter, it fails:
class Bar<T> : Foo<T> {
var _value T
def value T { # error: "value" overrides another function with the same name and argument types but a different return type in base type "Foo<T>"
return _value
}
def new(value T) {
super
_value = value
}
}
I was hoping to be able to do something like:
class Baz : Bar<string> {}
var baz = Baz.new("hello")
Am I doing something wrong or is this a (current?) limitation of generic type-checks?
Metadata
Assignees
Labels
No labels
Activity