From 1cf1346323e05b1d481fd2fe0b20a79ed94d9360 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 22 Mar 2022 22:00:03 -0700 Subject: [PATCH] Sema: rename isArrayLike to isArrayOrVector --- src/Sema.zig | 4 ++-- src/type.zig | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Sema.zig b/src/Sema.zig index dd9f2d74d8..ab73c55369 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -18780,7 +18780,7 @@ fn beginComptimePtrLoad( // If we're loading an elem_ptr that was derived from a different type // than the true type of the underlying decl, we cannot deref directly - const ty_matches = if (deref.pointee != null and deref.pointee.?.ty.isArrayLike()) x: { + const ty_matches = if (deref.pointee != null and deref.pointee.?.ty.isArrayOrVector()) x: { const deref_elem_ty = deref.pointee.?.ty.childType(); break :x (try sema.coerceInMemoryAllowed(block, deref_elem_ty, elem_ty, false, target, src, src)) == .ok or (try sema.coerceInMemoryAllowed(block, elem_ty, deref_elem_ty, false, target, src, src)) == .ok; @@ -18802,7 +18802,7 @@ fn beginComptimePtrLoad( if (maybe_array_ty) |load_ty| { // It's possible that we're loading a [N]T, in which case we'd like to slice // the pointee array directly from our parent array. - if (load_ty.isArrayLike() and load_ty.childType().eql(elem_ty, target)) { + if (load_ty.isArrayOrVector() and load_ty.childType().eql(elem_ty, target)) { const N = try sema.usizeCast(block, src, load_ty.arrayLenIncludingSentinel()); deref.pointee = if (elem_ptr.index + N <= check_len) TypedValue{ .ty = try Type.array(sema.arena, N, null, elem_ty, target), diff --git a/src/type.zig b/src/type.zig index 8668b36dca..d5b8e6f5b3 100644 --- a/src/type.zig +++ b/src/type.zig @@ -4734,7 +4734,7 @@ pub const Type = extern union { }; } - pub fn isArrayLike(ty: Type) bool { + pub fn isArrayOrVector(ty: Type) bool { return switch (ty.zigTypeTag()) { .Array, .Vector => true, else => false,