From 1b2f1221c4938fb3844d2a9d8dcca752fab7b9b7 Mon Sep 17 00:00:00 2001 From: Russel Arbore <russel.jma@gmail.com> Date: Sun, 9 Jun 2024 21:56:16 -0700 Subject: [PATCH] Fix try_array_type --- hercules_ir/src/ir.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hercules_ir/src/ir.rs b/hercules_ir/src/ir.rs index e0c2e9a3..072fc7b9 100644 --- a/hercules_ir/src/ir.rs +++ b/hercules_ir/src/ir.rs @@ -743,15 +743,15 @@ impl Constant { } pub fn try_array_type(&self, types: &[Type]) -> Option<TypeID> { - // Need types, since zero initializer may be for a collection type, ro + // Need types, since zero initializer may be for a collection type, or // not. match self { Constant::Array(ty, _) => Some(*ty), Constant::Zero(ty) => { - if types[ty.idx()].is_primitive() { - None - } else { + if types[ty.idx()].is_array() { Some(*ty) + } else { + None } } _ => None, -- GitLab