public interface IIntrinsicTypeReference
| Modifier and Type | Method and Description |
|---|---|
default IType |
getAssignableFeatureType()
The type this feature can be assigned from.
|
IType |
getFeatureType()
The type of this feature e.g., for a property this is the property's type.
|
IType getFeatureType()
default IType getAssignableFeatureType()
interface Foo {
property Name: CharSequence
}
class FooImpl implements Foo {
var _name: String
override property get Name(): String {
return _name
}
override property set Name( cs: CharSequence ) {
_name = cs.toString()
}
}
Here FooImpl overrides Foo's Name property with covariance on the
getter's return type. This establishes that Name wrt FooImpl is of
type String. Yet Foo's setter method must be overridden as-is,
a method cannot override another method with covariant parameters.
So, in terms of FooImpl's Name property, the setter method is
contravariant with String, which again is Name's type wrt
of FooImpl. Therefore, FooImpl's Name property should implement
getAssignableFeatureType() and return CharSequence.Copyright © 2022. All rights reserved.