authorgravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2018-05-30 10:30:09+02:00
committergravatar for jhc@dismail.deJimmi Holst Christensen <jhc@dismail.de> 2018-05-30 10:30:09+02:00
log2b3af4ef6b79b8fe178656b069f837eff82ae8c3
treeed74baa113045d386bd21d71259160f0f0d1994f
parentb0eebfa560b7c05859a535bf46abd8b9cf9306b3

fixed #1009

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.

2 files changed, 7 insertions(+), 4 deletions(-)

src/ir.cpp-4
...@@ -15982,10 +15982,6 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop...@@ -15982,10 +15982,6 @@ static void ir_make_type_info_defs(IrAnalyze *ira, ConstExprValue *out_val, Scop
15982 FnTableEntry *fn_entry = ((TldFn *)curr_entry->value)->fn_entry;15982 FnTableEntry *fn_entry = ((TldFn *)curr_entry->value)->fn_entry;
15983 assert(!fn_entry->is_test);15983 assert(!fn_entry->is_test);
1598415984
15985 analyze_fn_body(ira->codegen, fn_entry);
15986 if (fn_entry->anal_state == FnAnalStateInvalid)
15987 return;
15988
15989 AstNodeFnProto *fn_node = (AstNodeFnProto *)(fn_entry->proto_node);15985 AstNodeFnProto *fn_node = (AstNodeFnProto *)(fn_entry->proto_node);
1599015986
15991 ConstExprValue *fn_def_val = create_const_vals(1);15987 ConstExprValue *fn_def_val = create_const_vals(1);
test/cases/type_info.zig+7
...@@ -233,3 +233,10 @@ fn testFunction() void {...@@ -233,3 +233,10 @@ fn testFunction() void {
233fn foo(comptime a: usize, b: bool, args: ...) usize {233fn foo(comptime a: usize, b: bool, args: ...) usize {
234 return 0;234 return 0;
235}235}
236
237test "typeInfo with comptime parameter in struct fn def" {
238 const S = struct {
239 pub fn func(comptime x: f32) void {}
240 };
241 comptime var info = @typeInfo(S);
242}