We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
We can currently define default type parameters that are not compatible with their constraints:
class Foo<T:EnumValue = Void> { public var data:T; public final function new() {} }
https://try.haxe.org/#8B325355
When used, type inference will use a monomorph there:
// This is fine var e = new Foo(); $type(e.data); // Unknown<0> : EnumValue
But when explicitly using the default type parameter, it'll fail as expected:
// This is not fine var e:Foo = new Foo(); $type(e.data); // Void
[ERROR] Test.hx:7: characters 5-27 7 | var e:Foo = new Foo(); | ^^^^^^^^^^^^^^^^^^^^^^ | error: Void should be EnumValue | have: Foo<Void> | want: Foo<EnumValue>
We should probably catch that early, directly in class Foo<T:EnumValue = Void> declaration
class Foo<T:EnumValue = Void>
The text was updated successfully, but these errors were encountered:
I vaguely remember us saying "this is fine", but looking at it I'd also expect this to fail.
Sorry, something went wrong.
Closed by 060ff56
No branches or pull requests
We can currently define default type parameters that are not compatible with their constraints:
https://try.haxe.org/#8B325355
When used, type inference will use a monomorph there:
But when explicitly using the default type parameter, it'll fail as expected:
We should probably catch that early, directly in
class Foo<T:EnumValue = Void>
declarationThe text was updated successfully, but these errors were encountered: