HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.1k stars 647 forks source link

[diagnostics] top down type inference #7197

Open ncannasse opened 6 years ago

ncannasse commented 6 years ago

The following code creates a false positive Unresolved identifier FBone in diagnostics:

enum FxAttach {
    FBone(?name : String);
}

typedef FxOptions = {
    ?parent: FxAttach,
}

class A {
public function addFx(name : String, ?alias : String, ?addToFxs = true, ?opt : FxOptions) {
}
}

And another file:

class B extends A {
   ...
   addFx("Sparkles01", {parent: FBone("FX_Sparkles01")});
}
ncannasse commented 6 years ago

It can also create Arrays of mixed types are only allowed if the type is forced to Array<Dynamic> when you have Array of structures with optional arguments (which types correctly with top down type inference)

Simn commented 6 years ago

This will probably make me rethink how we handle diagnostics. I think it shouldn't be a display mode but use some other flag. That way we can treat it as normal compilation which just collects some additional data.

Simn commented 1 year ago

Interestingly, this still reproduces.