add compile error for missing parameter name of generic function
This commit is contained in:
parent
84195467ad
commit
fd575fe1f3
@ -12591,6 +12591,7 @@ static bool ir_analyze_fn_call_generic_arg(IrAnalyze *ira, AstNode *fn_proto_nod
|
|||||||
}
|
}
|
||||||
|
|
||||||
Buf *param_name = param_decl_node->data.param_decl.name;
|
Buf *param_name = param_decl_node->data.param_decl.name;
|
||||||
|
if (!param_name) return false;
|
||||||
if (!is_var_args) {
|
if (!is_var_args) {
|
||||||
VariableTableEntry *var = add_variable(ira->codegen, param_decl_node,
|
VariableTableEntry *var = add_variable(ira->codegen, param_decl_node,
|
||||||
*child_scope, param_name, true, arg_val, nullptr);
|
*child_scope, param_name, true, arg_val, nullptr);
|
||||||
|
@ -1,6 +1,17 @@
|
|||||||
const tests = @import("tests.zig");
|
const tests = @import("tests.zig");
|
||||||
|
|
||||||
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||||
|
cases.add(
|
||||||
|
"missing parameter name of generic function",
|
||||||
|
\\fn dump(var) void {}
|
||||||
|
\\export fn entry() void {
|
||||||
|
\\ var a: u8 = 9;
|
||||||
|
\\ dump(a);
|
||||||
|
\\}
|
||||||
|
,
|
||||||
|
".tmp_source.zig:1:9: error: missing parameter name",
|
||||||
|
);
|
||||||
|
|
||||||
cases.add(
|
cases.add(
|
||||||
"non-inline for loop on a type that requires comptime",
|
"non-inline for loop on a type that requires comptime",
|
||||||
\\const Foo = struct {
|
\\const Foo = struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user