mirror of
https://github.com/ziglang/zig.git
synced 2024-12-04 02:48:50 +00:00
parent
ee22e87296
commit
3b535d2c3a
@ -4674,7 +4674,7 @@ static TypeTableEntry *analyze_generic_fn_call(CodeGen *g, ImportTableEntry *imp
|
|||||||
}
|
}
|
||||||
AstNode **param_node = &node->data.fn_call_expr.params.at(i);
|
AstNode **param_node = &node->data.fn_call_expr.params.at(i);
|
||||||
|
|
||||||
TypeTableEntry *param_type = analyze_expression(g, import, child_context, expected_param_type,
|
TypeTableEntry *param_type = analyze_expression(g, import, parent_context, expected_param_type,
|
||||||
*param_node);
|
*param_node);
|
||||||
if (param_type->id == TypeTableEntryIdInvalid) {
|
if (param_type->id == TypeTableEntryIdInvalid) {
|
||||||
return param_type;
|
return param_type;
|
||||||
|
@ -1781,6 +1781,13 @@ b";
|
|||||||
fn foo() {}
|
fn foo() {}
|
||||||
const invalid = foo > foo;
|
const invalid = foo > foo;
|
||||||
)SOURCE", 1, ".tmp_source.zig:3:21: error: operator not allowed for type 'fn()'");
|
)SOURCE", 1, ".tmp_source.zig:3:21: error: operator not allowed for type 'fn()'");
|
||||||
|
|
||||||
|
add_compile_fail_case("generic function instance with non-constant expression", R"SOURCE(
|
||||||
|
fn foo(x: i32)(y: i32) -> i32 { return x + y; }
|
||||||
|
fn test1(a: i32, b: i32) -> i32 {
|
||||||
|
return foo(a)(b);
|
||||||
|
}
|
||||||
|
)SOURCE", 1, ".tmp_source.zig:4:16: error: unable to resolve constant expression");
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user