Skip to content

Commit

Permalink
fail nicer if unify_min can't find a common type
Browse files Browse the repository at this point in the history
closes #11684
  • Loading branch information
Simn committed Jun 4, 2024
1 parent 245a480 commit cc105eb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/tUnification.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ module UnifyMinT = struct
begin match common_types with
| [] ->
begin match !first_error with
| None -> die "" __LOC__
| None -> UnifyMinError([Unify_custom "Could not determine common type, please add a type-hint"],0)
| Some(l,p) -> UnifyMinError(l,p)
end
| hd :: _ ->
Expand Down
5 changes: 5 additions & 0 deletions tests/misc/projects/Issue11684/Main.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function test(input) {
return (input is Array) ? input[0] : input;
}

function main() {}
2 changes: 2 additions & 0 deletions tests/misc/projects/Issue11684/compile-fail.hxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--main Main
--interp
1 change: 1 addition & 0 deletions tests/misc/projects/Issue11684/compile-fail.hxml.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Main.hx:2: characters 42-47 : Could not determine common type, please add a type-hint

0 comments on commit cc105eb

Please sign in to comment.