Skip to content

Commit

Permalink
[typer] don't die when resolving overloads with not enough arguments
Browse files Browse the repository at this point in the history
closes #10434
  • Loading branch information
RealyUniqueName committed Oct 22, 2021
1 parent 5d3ccee commit d8a7f85
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions extra/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

all : fixed errors on final vars modification with `+=`, `*=` etc operations (#10325)
all : fixed hanging of MainLoop.add on threaded targets (#10308, #10329)
all : fixed compiler crash when resolving overloads with not enough arguments (#10434)
display : improved code completion in anonymous objects declarations (#10414)
js : fixed IntMap for keys greater than 2^31 (#10316)
js : workaround to fix sourcemaps on Firefox in Windows (#10217)
Expand Down
3 changes: 3 additions & 0 deletions src/codegen/overloads.ml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ struct
acc @ rates
| e :: elist, (n,o,t) :: args ->
mk_rate ((rate_arg t e) :: acc) elist args
| [],_ ->
(* this can happen on pf_pad_nulls = false targets, see #10434 *)
acc
| _ -> die "" __LOC__
in

Expand Down
8 changes: 8 additions & 0 deletions tests/misc/js/projects/Issue10434/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extern class ToolCache {
overload static function extractTar(?flags:Array<String>):Void;
overload static function extractTar(?flags:String):Void;
}

function main() {
ToolCache.extractTar();
}
1 change: 1 addition & 0 deletions tests/misc/js/projects/Issue10434/compile-fail.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--run Main
3 changes: 3 additions & 0 deletions tests/misc/js/projects/Issue10434/compile-fail.hxml.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Main.hx:7: characters 2-24 : Ambiguous overload, candidates follow
Main.hx:2: characters 27-37 : ... (?flags : Null<Array<String>>) -> Void
Main.hx:3: characters 27-37 : ... (?flags : Null<String>) -> Void

0 comments on commit d8a7f85

Please sign in to comment.