-
-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify structure with one that requires more fields if all of them are read only and optional. #6031
Comments
If I recall correctly, @ousado has shown that this is not sound. |
Upon second though I realize now that this requires special treatment on some static targets when the object is actually an instance. Right now it can just blow up: http://try.haxe.org/#Fd4A1 - that said, an additional check could be performed before accessing |
Yes, it's not sound - the following would compile: class Test {
static function main() {
var m2:More2 = {foo:1,bar:"2"};
var l:Less = m2;
var m:More = l;
}
}
typedef Less = {
var foo(default, never):Int;
}
typedef More = {
@:optional var foo(default, never):Int;
@:optional var bar(default, never):Int;
}
typedef More2 = {
var foo(default, never):Int;
var bar(default, never):String;
} |
Well, I suppose it's generally a fair question whether |
Basically I would like this to compile:
The compiler tells me
Less should be More
but I would argue that in this caseLess
indeed isMore
;)The text was updated successfully, but these errors were encountered: