authorgravatar for spexguy070@gmail.comMartin Wickham <spexguy070@gmail.com> 2021-10-01 00:43:39-05:00
committergravatar for spexguy070@gmail.comMartin Wickham <spexguy070@gmail.com> 2021-10-02 15:21:48-05:00
logd1a4bdb1f375b6aa737f1c02c346899336465e00
tree12b2468c452843e8c6ccde6a2d578ae80964daf5
parentf7c11acb7f487806b14ada9d13d6afe8d3fe54d5

Declare generic fn dependency earlier to keep invariant


1 files changed, 5 insertions(+), 5 deletions(-)

src/Sema.zig+5-5
...@@ -3279,6 +3279,11 @@ fn analyzeCall(...@@ -3279,6 +3279,11 @@ fn analyzeCall(
32793279
3280 namespace.anon_decls.putAssumeCapacityNoClobber(new_decl, {});3280 namespace.anon_decls.putAssumeCapacityNoClobber(new_decl, {});
32813281
3282 // The generic function Decl is guaranteed to be the first dependency
3283 // of each of its instantiations.
3284 assert(new_decl.dependencies.keys().len == 0);
3285 try mod.declareDeclDependency(new_decl, module_fn.owner_decl);
3286
3282 var new_decl_arena = std.heap.ArenaAllocator.init(sema.gpa);3287 var new_decl_arena = std.heap.ArenaAllocator.init(sema.gpa);
3283 errdefer new_decl_arena.deinit();3288 errdefer new_decl_arena.deinit();
32843289
...@@ -3411,11 +3416,6 @@ fn analyzeCall(...@@ -3411,11 +3416,6 @@ fn analyzeCall(
3411 });3416 });
3412 assert(!new_decl.ty.fnInfo().is_generic);3417 assert(!new_decl.ty.fnInfo().is_generic);
34133418
3414 // The generic function Decl is guaranteed to be the first dependency
3415 // of each of its instantiations.
3416 assert(new_decl.dependencies.keys().len == 0);
3417 try mod.declareDeclDependency(new_decl, module_fn.owner_decl);
3418
3419 // Queue up a `codegen_func` work item for the new Fn. The `comptime_args` field3419 // Queue up a `codegen_func` work item for the new Fn. The `comptime_args` field
3420 // will be populated, ensuring it will have `analyzeBody` called with the ZIR3420 // will be populated, ensuring it will have `analyzeBody` called with the ZIR
3421 // parameters mapped appropriately.3421 // parameters mapped appropriately.