| author | |
| committer | |
| log | 3b535d2c3af5259a71916681d87ab0c01f24b58d |
| tree | 61816becd81c72f3a8af790798c0f42bf443b5d9 |
| parent | ee22e872967947d2f6e64cba888bf7bf56e4d332 |
See #222 files changed, 8 insertions(+), 1 deletions(-)
src/analyze.cpp+1-1| ... | @@ -4674,7 +4674,7 @@ static TypeTableEntry *analyze_generic_fn_call(CodeGen *g, ImportTableEntry *imp | ... | @@ -4674,7 +4674,7 @@ static TypeTableEntry *analyze_generic_fn_call(CodeGen *g, ImportTableEntry *imp |
| 4674 | } | 4674 | } |
| 4675 | AstNode **param_node = &node->data.fn_call_expr.params.at(i); | 4675 | AstNode **param_node = &node->data.fn_call_expr.params.at(i); |
| 4676 | 4676 | ||
| 4677 | TypeTableEntry *param_type = analyze_expression(g, import, child_context, expected_param_type, | 4677 | TypeTableEntry *param_type = analyze_expression(g, import, parent_context, expected_param_type, |
| 4678 | *param_node); | 4678 | *param_node); |
| 4679 | if (param_type->id == TypeTableEntryIdInvalid) { | 4679 | if (param_type->id == TypeTableEntryIdInvalid) { |
| 4680 | return param_type; | 4680 | return param_type; |
test/run_tests.cpp+7| ... | @@ -1781,6 +1781,13 @@ b"; | ... | @@ -1781,6 +1781,13 @@ b"; |
| 1781 | fn foo() {} | 1781 | fn foo() {} |
| 1782 | const invalid = foo > foo; | 1782 | const invalid = foo > foo; |
| 1783 | )SOURCE", 1, ".tmp_source.zig:3:21: error: operator not allowed for type 'fn()'"); | 1783 | )SOURCE", 1, ".tmp_source.zig:3:21: error: operator not allowed for type 'fn()'"); |
| 1784 | |||
| 1785 | add_compile_fail_case("generic function instance with non-constant expression", R"SOURCE( | ||
| 1786 | fn foo(x: i32)(y: i32) -> i32 { return x + y; } | ||
| 1787 | fn test1(a: i32, b: i32) -> i32 { | ||
| 1788 | return foo(a)(b); | ||
| 1789 | } | ||
| 1790 | )SOURCE", 1, ".tmp_source.zig:4:16: error: unable to resolve constant expression"); | ||
| 1784 | } | 1791 | } |
| 1785 | 1792 | ||
| 1786 | ////////////////////////////////////////////////////////////////////////////// | 1793 | ////////////////////////////////////////////////////////////////////////////// |