Skip to content

Commit

Permalink
[typer] don't eagerly display in check_error
Browse files Browse the repository at this point in the history
We might want to raise instead if we're in_call_args in order to support overload resolution.
closes #11274
  • Loading branch information
Simn committed Nov 9, 2023
1 parent bdd7bf4 commit 1e5b2a2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/typing/operators.ml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let check_error ctx err = match err.err_message with
| Module_not_found ([],name) when Diagnostics.error_in_diagnostics_run ctx.com err.err_pos ->
DisplayToplevel.handle_unresolved_identifier ctx name err.err_pos true
| _ ->
Common.display_error_ext ctx.com err
raise_or_display_error ctx err

module BinopResult = struct

Expand Down
3 changes: 2 additions & 1 deletion tests/misc/projects/Issue8634/compile-fail.hxml.stderr
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Main.hx:4: characters 13-17 : Cannot use null as ternary condition
Main.hx:4: characters 13-17 : Cannot use null as ternary condition
Main.hx:4: characters 13-17 : ... For function argument 'v'
33 changes: 33 additions & 0 deletions tests/unit/src/unit/issues/Issue11274.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package unit.issues;

using unit.issues.Issue11274.SpriteTools;

private class Sprite {
public function new() {}
}

private class SpriteTools {
public static function setName(sprite:Sprite, name:String):Void {}
}

class Issue11274 extends unit.Test {
static var mark = false;

function test() {
sprite(foo -> {
foo.setName("foo");
add(foo); // err
});
t(mark);
}

extern inline overload static function sprite(callback:(sprite:Sprite) -> Void) {
callback(new Sprite());
}

extern inline overload static function sprite(name:String, callback:(sprite:Sprite) -> Void) {}

static function add(sprite:Sprite):Void {
mark = true;
}
}

0 comments on commit 1e5b2a2

Please sign in to comment.