You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect handling of Self type in abstract parent #92
Describe the problem. What did you see? What did you expect to see?
A method which returns Self, when fallen through from an abstract, should return the abstract type, not the parent type.
If this is a code issue, provide a minimal code example:
struct Parent {
public var x: Int;
public var y: Int;
public function copy(): Self {
return struct Self {x: this.x, y: this.y};
}
}
abstract Child: Parent;
function main() {
var x: Child = struct Child {x: 1, y: 1};
var y: Child = x.copy();
}
----------------------------------------
Error: ./test.kit:14: A variable's initial value must match the variable's type:
@./test.kit:14:20-25
14 var y: Child = x.copy();
^^^^^^
Expected type: test.Child
Actual type: test.Parent
Activity