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.
This commit is contained in:
Andrew Kelley
2022-03-23 23:28:05 -07:00
parent aca42c6259
commit 2af69710a7
4 changed files with 88 additions and 21 deletions

View File

@@ -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));
}