ir_make_type_info_defs already calls resolve_top_level_decl on all Tld
when building the def array. This means, that there is no reason that
analyze_fn_body is nessesary, as the fn type should have already been
resolved completly. The only thing analyze_fn_body does here, is cause
problems with generic functions.
master
Jimmi HC 2018-05-30 10:30:09 +02:00
parent b0eebfa560
commit 2b3af4ef6b
2 changed files with 7 additions and 4 deletions

View File

@ -15982,10 +15982,6 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
FnTableEntry *fn_entry = ((TldFn *)curr_entry->value)->fn_entry; FnTableEntry *fn_entry = ((TldFn *)curr_entry->value)->fn_entry;
assert(!fn_entry->is_test); assert(!fn_entry->is_test);
analyze_fn_body(ira->codegen, fn_entry);
if (fn_entry->anal_state == FnAnalStateInvalid)
return;
AstNodeFnProto *fn_node = (AstNodeFnProto *)(fn_entry->proto_node); AstNodeFnProto *fn_node = (AstNodeFnProto *)(fn_entry->proto_node);
ConstExprValue *fn_def_val = create_const_vals(1); ConstExprValue *fn_def_val = create_const_vals(1);

View File

@ -233,3 +233,10 @@ fn testFunction() void {
fn foo(comptime a: usize, b: bool, args: ...) usize { fn foo(comptime a: usize, b: bool, args: ...) usize {
return 0; return 0;
} }
test "typeInfo with comptime parameter in struct fn def" {
const S = struct {
pub fn func(comptime x: f32) void {}
};
comptime var info = @typeInfo(S);
}