| ... | @@ -5012,7 +5012,12 @@ fn analyzeCall( | ... | @@ -5012,7 +5012,12 @@ fn analyzeCall( |
| 5012 | // parameter or return type. | 5012 | // parameter or return type. |
| 5013 | return error.GenericPoison; | 5013 | return error.GenericPoison; |
| 5014 | }, | 5014 | }, |
| 5015 | else => {}, | 5015 | else => { |
| | 5016 | // Needed so that lazy values do not trigger |
| | 5017 | // assertion due to type not being resolved |
| | 5018 | // when the hash function is called. |
| | 5019 | try sema.resolveLazyValue(&child_block, arg_src, arg_val); |
| | 5020 | }, |
| 5016 | } | 5021 | } |
| 5017 | should_memoize = should_memoize and !arg_val.canMutateComptimeVarState(); | 5022 | should_memoize = should_memoize and !arg_val.canMutateComptimeVarState(); |
| 5018 | memoized_call_key.args[arg_i] = .{ | 5023 | memoized_call_key.args[arg_i] = .{ |
| ... | @@ -5039,7 +5044,12 @@ fn analyzeCall( | ... | @@ -5039,7 +5044,12 @@ fn analyzeCall( |
| 5039 | // parameter or return type. | 5044 | // parameter or return type. |
| 5040 | return error.GenericPoison; | 5045 | return error.GenericPoison; |
| 5041 | }, | 5046 | }, |
| 5042 | else => {}, | 5047 | else => { |
| | 5048 | // Needed so that lazy values do not trigger |
| | 5049 | // assertion due to type not being resolved |
| | 5050 | // when the hash function is called. |
| | 5051 | try sema.resolveLazyValue(&child_block, arg_src, arg_val); |
| | 5052 | }, |
| 5043 | } | 5053 | } |
| 5044 | should_memoize = should_memoize and !arg_val.canMutateComptimeVarState(); | 5054 | should_memoize = should_memoize and !arg_val.canMutateComptimeVarState(); |
| 5045 | memoized_call_key.args[arg_i] = .{ | 5055 | memoized_call_key.args[arg_i] = .{ |
| ... | @@ -21601,6 +21611,23 @@ pub fn resolveFnTypes( | ... | @@ -21601,6 +21611,23 @@ pub fn resolveFnTypes( |
| 21601 | } | 21611 | } |
| 21602 | } | 21612 | } |
| 21603 | | 21613 | |
| | 21614 | /// Make it so that calling hash() and eql() on `val` will not assert due |
| | 21615 | /// to a type not having its layout resolved. |
| | 21616 | fn resolveLazyValue( |
| | 21617 | sema: *Sema, |
| | 21618 | block: *Block, |
| | 21619 | src: LazySrcLoc, |
| | 21620 | val: Value, |
| | 21621 | ) CompileError!void { |
| | 21622 | switch (val.tag()) { |
| | 21623 | .lazy_align => { |
| | 21624 | const ty = val.castTag(.lazy_align).?.data; |
| | 21625 | return sema.resolveTypeLayout(block, src, ty); |
| | 21626 | }, |
| | 21627 | else => return, |
| | 21628 | } |
| | 21629 | } |
| | 21630 | |
| 21604 | pub fn resolveTypeLayout( | 21631 | pub fn resolveTypeLayout( |
| 21605 | sema: *Sema, | 21632 | sema: *Sema, |
| 21606 | block: *Block, | 21633 | block: *Block, |