| ... | @@ -3924,7 +3924,11 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. | ... | @@ -3924,7 +3924,11 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. |
| 3924 | const object_ty = sema.typeOf(object); | 3924 | const object_ty = sema.typeOf(object); |
| 3925 | // Each arg could be an indexable, or a range, in which case the length | 3925 | // Each arg could be an indexable, or a range, in which case the length |
| 3926 | // is passed directly as an integer. | 3926 | // is passed directly as an integer. |
| 3927 | const arg_len = if (object_ty.zigTypeTag() == .Int) object else l: { | 3927 | const is_int = switch (object_ty.zigTypeTag()) { |
| | 3928 | .Int, .ComptimeInt => true, |
| | 3929 | else => false, |
| | 3930 | }; |
| | 3931 | const arg_len = if (is_int) object else l: { |
| 3928 | try checkIndexable(sema, block, src, object_ty); | 3932 | try checkIndexable(sema, block, src, object_ty); |
| 3929 | if (!object_ty.indexableHasLen()) continue; | 3933 | if (!object_ty.indexableHasLen()) continue; |
| 3930 | | 3934 | |