Skip to content

Commit

Permalink
re-unify upon reapplying overloaded calls (fixes HaxeFoundation#9854)
Browse files Browse the repository at this point in the history
  • Loading branch information
RealyUniqueName committed Jan 21, 2021
1 parent 7928a86 commit d764121
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/typing/callUnification.ml
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,10 @@ let maybe_reapply_overload_call ctx e =
let recall fh cf =
let fa = FieldAccess.create e1 cf fh false ef.epos in
let fcc = unify_field_call ctx fa el [] e.epos false in
fcc.fc_data()
let e1 = fcc.fc_data() in
(try Type.unify e1.etype e.etype
with Unify_error _ -> die ~p:e.epos "Failed to reapply overload call" __LOC__);
e1
in
begin match fa with
| FStatic(c,cf) when has_class_field_flag cf CfOverload ->
Expand Down
15 changes: 15 additions & 0 deletions tests/misc/projects/Issue9854/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Main {
overload
static function infer<T>(s:String):T {
return null;
}

static inline function inlineMe():String {
return infer("foo");
}

static function main() {
var x = inlineMe();
$type(x); // Unknown<0>
}
}
2 changes: 2 additions & 0 deletions tests/misc/projects/Issue9854/compile.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--main Main
--jvm bin/test.jar
1 change: 1 addition & 0 deletions tests/misc/projects/Issue9854/compile.hxml.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Main.hx:13: characters 9-10 : Warning : String

0 comments on commit d764121

Please sign in to comment.