diff --git a/tests/misc/projects/Issue11753/Main.hx b/tests/misc/projects/Issue11753/Main.hx new file mode 100644 index 00000000000..18e0e373dd6 --- /dev/null +++ b/tests/misc/projects/Issue11753/Main.hx @@ -0,0 +1,31 @@ +class Main { + static var doThings : Foo -> Void; + + static function main() { + var foo = new Foo(); + doThings = (foo -> doThingsImpl(foo)); + doThings(foo); + } + + static function doThingsImpl(foo) { + foo.doWithBar(); + $type(foo); + $type(foo.doWithBar); + + if (foo != null) trace(foo); + $type(foo); + $type(foo.doWithBar); + } +} + +class Foo { + public function new() {} + public function doWithBar(?bar:Bar) { + trace(bar); + } +} + +@:keep +class Bar { + public function new() {} +} diff --git a/tests/misc/projects/Issue11753/compile-fail.hxml b/tests/misc/projects/Issue11753/compile-fail.hxml new file mode 100644 index 00000000000..740e71e491b --- /dev/null +++ b/tests/misc/projects/Issue11753/compile-fail.hxml @@ -0,0 +1,3 @@ +-main Main +--hl bin/main.hl +-D message.no-color diff --git a/tests/misc/projects/Issue11753/compile-fail.hxml.stderr b/tests/misc/projects/Issue11753/compile-fail.hxml.stderr new file mode 100644 index 00000000000..fad32fc2f15 --- /dev/null +++ b/tests/misc/projects/Issue11753/compile-fail.hxml.stderr @@ -0,0 +1,30 @@ +[WARNING] Main.hx:12: characters 9-12 + + 12 | $type(foo); + | ^^^ + | Unknown<0> : { doWithBar : () -> Unknown<1> } + +[WARNING] Main.hx:13: characters 9-22 + + 13 | $type(foo.doWithBar); + | ^^^^^^^^^^^^^ + | () -> Unknown<0> + +[WARNING] Main.hx:16: characters 9-12 + + 16 | $type(foo); + | ^^^ + | Null> + +[WARNING] Main.hx:17: characters 9-22 + + 17 | $type(foo.doWithBar); + | ^^^^^^^^^^^^^ + | Unknown<0> + +[ERROR] Main.hx:11: characters 3-16 + + 11 | foo.doWithBar(); + | ^^^^^^^^^^^^^ + | Don't know how to cast (Bar):void to ():dyn +