authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-04-07 22:58:50-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-04-07 22:58:50-07:00
log737ef3e81b4a417b3f81d54a419644fc8fb6b964
treec14de70f33c89328bb8251b1c70eba28dc94440c
parent93e11b824a37a14fc392bfc64ed8f364f4fc7d46

Sema: remove unnecessary type resolution

This causes false positive "foo depends on itself" errors. Prior to some recent enhancements, this type resolution was needed, however, we now have a more sophisticated type resolution mechanism that fully resolves types for the backend, but only after the Decl is fully analyzed, avoiding dependency loops.

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

src/Sema.zig+1-2
...@@ -18026,8 +18026,7 @@ fn coerce(...@@ -18026,8 +18026,7 @@ fn coerce(
18026 const array_ty = inst_ty.childType();18026 const array_ty = inst_ty.childType();
18027 if (array_ty.zigTypeTag() != .Array) break :src_array_ptr;18027 if (array_ty.zigTypeTag() != .Array) break :src_array_ptr;
18028 const len0 = array_ty.arrayLen() == 0;18028 const len0 = array_ty.arrayLen() == 0;
18029 // We resolve here so that the backend has the layout of the elem type.18029 const array_elem_type = array_ty.childType();
18030 const array_elem_type = try sema.resolveTypeFields(block, inst_src, array_ty.childType());
18031 const dest_is_mut = dest_info.mutable;18030 const dest_is_mut = dest_info.mutable;
18032 if (inst_ty.isConstPtr() and dest_is_mut and !len0) break :src_array_ptr;18031 if (inst_ty.isConstPtr() and dest_is_mut and !len0) break :src_array_ptr;
18033 if (inst_ty.isVolatilePtr() and !dest_info.@"volatile") break :src_array_ptr;18032 if (inst_ty.isVolatilePtr() and !dest_info.@"volatile") break :src_array_ptr;