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
using Main; class Main { static public function main() { var obj = merge({foo: 12}, {bar: "bar"}); obj.staticExtension(); } static function merge<A:{}, B:{}, C:A & B>(a:A, b:B):C { return null; } static function staticExtension(a:{foo:Int, bar:String}) {} }
source/Main.hx:6: characters 7-22 : Unknown<0> : { foo : Int, bar : String } has no field staticExtension
This is probably just a missing using_field in the TMono code path of type_field.
using_field
TMono
type_field
The text was updated successfully, but these errors were encountered:
I thought I found a regression with code like this:
using Main; class Main { static public function main() { infer({foo: 12}); } static function infer(a) { a.foo = 12; a.staticExtension(); } static function staticExtension(a:{foo:Int}) {} }
source/Main.hx:5: characters 9-18 : Object requires field staticExtension source/Main.hx:5: characters 9-18 : For function argument 'a'
But that was failing before as well. I guess it makes sense that it does.
However, completion shows staticExtension as a field on a, so there's some discrepancy here.
staticExtension
a
Sorry, something went wrong.
a2e1309
It would be great to have this working:
static function merge<A:{}, B:{}>(a:A, b:B):A & B { return null; }
It's different to the constraint C Example, because C opens the type on the call side which means
C
var x: { foo: Int, bar: Int, ohno: Int } = merge({ foo: 1}, { bar: 2});
compiles just fine.
Simn
No branches or pull requests
This is probably just a missing
using_field
in theTMono
code path oftype_field
.The text was updated successfully, but these errors were encountered: