-
-
Notifications
You must be signed in to change notification settings - Fork 671
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
Null<T> should not satisfy type constraint T #12020
Comments
That would likely break a lot of things.. 🤔 |
A similar example where at least this should not trigger double function main() {
var x:Null<String> = "";
var zz = testfn(x);
$type(zz); // Null<Null<String>>
}
function testfn<T>(x:T) {
var arr = [x];
return arr.pop();
} (I thought we already did some things to avoid |
Could we make it so that function wrap<T:String>(v:T) {
return v;
}
function main() {
final nullable:Null<String> = null;
$type(wrap(nullable)); // currently Null<String>, would be String
} This solution would also solve our problem at #12019.
Also, your sample does not require the testfn function to reproduce: function main() {
var x:Null<String> = "";
var arr = [x];
$type(arr.pop());
} (I also don't think it's related to this problem, since the T in |
This compiles fine and leads to a null access error:
The text was updated successfully, but these errors were encountered: