diff --git a/hercules_ir/src/ir.rs b/hercules_ir/src/ir.rs index e0c2e9a34023cd5f9aa38d2d07a0c1ac018e61b5..072fc7b9413b78ecaf2c057539de89c1a2d5c2a5 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,