| ... | @@ -27979,6 +27979,8 @@ fn structFieldVal( | ... | @@ -27979,6 +27979,8 @@ fn structFieldVal( |
| 27979 | } | 27979 | } |
| 27980 | | 27980 | |
| 27981 | const field_ty = Type.fromInterned(struct_type.field_types.get(ip)[field_index]); | 27981 | const field_ty = Type.fromInterned(struct_type.field_types.get(ip)[field_index]); |
| | 27982 | if (try sema.typeHasOnePossibleValue(field_ty)) |field_val| |
| | 27983 | return Air.internedToRef(field_val.toIntern()); |
| 27982 | | 27984 | |
| 27983 | if (try sema.resolveValue(struct_byval)) |struct_val| { | 27985 | if (try sema.resolveValue(struct_byval)) |struct_val| { |
| 27984 | if (struct_val.isUndef(mod)) return mod.undefRef(field_ty); | 27986 | if (struct_val.isUndef(mod)) return mod.undefRef(field_ty); |
| ... | @@ -28620,8 +28622,6 @@ fn elemValArray( | ... | @@ -28620,8 +28622,6 @@ fn elemValArray( |
| 28620 | try sema.validateRuntimeElemAccess(block, elem_index_src, elem_ty, array_ty, array_src); | 28622 | try sema.validateRuntimeElemAccess(block, elem_index_src, elem_ty, array_ty, array_src); |
| 28621 | | 28623 | |
| 28622 | const runtime_src = if (maybe_undef_array_val != null) elem_index_src else array_src; | 28624 | const runtime_src = if (maybe_undef_array_val != null) elem_index_src else array_src; |
| 28623 | try sema.requireRuntimeBlock(block, src, runtime_src); | | |
| 28624 | try sema.queueFullTypeResolution(array_ty); | | |
| 28625 | if (oob_safety and block.wantSafety()) { | 28625 | if (oob_safety and block.wantSafety()) { |
| 28626 | // Runtime check is only needed if unable to comptime check | 28626 | // Runtime check is only needed if unable to comptime check |
| 28627 | if (maybe_index_val == null) { | 28627 | if (maybe_index_val == null) { |
| ... | @@ -28630,6 +28630,12 @@ fn elemValArray( | ... | @@ -28630,6 +28630,12 @@ fn elemValArray( |
| 28630 | try sema.panicIndexOutOfBounds(block, src, elem_index, len_inst, cmp_op); | 28630 | try sema.panicIndexOutOfBounds(block, src, elem_index, len_inst, cmp_op); |
| 28631 | } | 28631 | } |
| 28632 | } | 28632 | } |
| | 28633 | |
| | 28634 | if (try sema.typeHasOnePossibleValue(elem_ty)) |elem_val| |
| | 28635 | return Air.internedToRef(elem_val.toIntern()); |
| | 28636 | |
| | 28637 | try sema.requireRuntimeBlock(block, src, runtime_src); |
| | 28638 | try sema.queueFullTypeResolution(array_ty); |
| 28633 | return block.addBinOp(.array_elem_val, array, elem_index); | 28639 | return block.addBinOp(.array_elem_val, array, elem_index); |
| 28634 | } | 28640 | } |
| 28635 | | 28641 | |