From: Brendan Hansen Date: Mon, 17 Oct 2022 22:52:14 +0000 (-0500) Subject: fixed tiny but significant double polymorph issue X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=ecad2140dd8eb9e8c4b2d53a1112975c27d87fd0;p=onyx.git fixed tiny but significant double polymorph issue --- diff --git a/compiler/src/checker.c b/compiler/src/checker.c index 0854670c..2f2ad2f6 100644 --- a/compiler/src/checker.c +++ b/compiler/src/checker.c @@ -3150,7 +3150,11 @@ CheckStatus check_polyquery(AstPolyQuery *query) { goto poly_var_solved; case TYPE_MATCH_SPECIAL: - return Check_Yield_Macro; + if (solved_something || query->successful_symres) { + return Check_Return_To_Symres; + } else { + return Check_Yield_Macro; + } case TYPE_MATCH_YIELD: case TYPE_MATCH_FAILED: { diff --git a/tests/bugs/double_polymorph_yield_error b/tests/bugs/double_polymorph_yield_error new file mode 100644 index 00000000..f605338a --- /dev/null +++ b/tests/bugs/double_polymorph_yield_error @@ -0,0 +1,3 @@ +0x110A0 +false +bool diff --git a/tests/bugs/double_polymorph_yield_error.onyx b/tests/bugs/double_polymorph_yield_error.onyx new file mode 100644 index 00000000..eec85551 --- /dev/null +++ b/tests/bugs/double_polymorph_yield_error.onyx @@ -0,0 +1,15 @@ +#load "core/std" + +use core + +q :: (v: ^$C, g: (^C) -> $T) { + println(v); + println(g(v)); + println(T); +} + +main :: () { + v := 5; + + q(^v, _ => false); +} \ No newline at end of file