From 2af69710a7b1513f3540ae0e1178cb5f3948204d Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 23 Mar 2022 23:28:05 -0700 Subject: stage2: fix some generics issues * std.meta: correct use of `default_value` in reification. stage1 accepted a wrong type for `null`. * Sema: after instantiating a generic function, if the return type ends up being a comptime-known type, then we return an error, undoing the generic function instantiation, and making a comptime function call instead. - We also needed to clean up the dependency graph in this case. * Sema: reified enums set tag_ty_inferred to false since an integer tag type is provided. This is a limitation of the `@Type` builtin which will be addressed with #10710. * Sema: fix resolveInferredErrorSet incorrectly calling ensureFuncBodyAnalyzed on generic functions. --- src/Module.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index 79d6343949..0666936f1f 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -781,11 +781,11 @@ pub const Decl = struct { return &decl_plus_emit_h.emit_h; } - fn removeDependant(decl: *Decl, other: *Decl) void { + pub fn removeDependant(decl: *Decl, other: *Decl) void { assert(decl.dependants.swapRemove(other)); } - fn removeDependency(decl: *Decl, other: *Decl) void { + pub fn removeDependency(decl: *Decl, other: *Decl) void { assert(decl.dependencies.swapRemove(other)); } -- cgit v1.2.3