| author | |
| committer | |
| log | ce95cc170bfa763d31fc498169ee9e44adca57fa |
| tree | 3cee5eca0147f968931af63d153e8ede95783aee |
| parent | 9a52abf3b47447b4ce976a99daca1c9c859c5aca |
Closes #127022 files changed, 14 insertions(+), 0 deletions(-)
src/value.zig+3| ... | @@ -2555,6 +2555,9 @@ pub const Value = extern union { | ... | @@ -2555,6 +2555,9 @@ pub const Value = extern union { |
| 2555 | .lazy_size, | 2555 | .lazy_size, |
| 2556 | => return hashInt(ptr_val, hasher, target), | 2556 | => return hashInt(ptr_val, hasher, target), |
| 2557 | 2557 | ||
| 2558 | // The value is runtime-known and shouldn't affect the hash. | ||
| 2559 | .runtime_int => {}, | ||
| 2560 | |||
| 2558 | else => unreachable, | 2561 | else => unreachable, |
| 2559 | } | 2562 | } |
| 2560 | } | 2563 | } |
test/behavior/src.zig+11| ... | @@ -20,3 +20,14 @@ test "@src" { | ... | @@ -20,3 +20,14 @@ test "@src" { |
| 20 | 20 | ||
| 21 | try doTheTest(); | 21 | try doTheTest(); |
| 22 | } | 22 | } |
| 23 | |||
| 24 | test "@src used as a comptime parameter" { | ||
| 25 | const S = struct { | ||
| 26 | fn Foo(comptime _: std.builtin.SourceLocation) type { | ||
| 27 | return struct {}; | ||
| 28 | } | ||
| 29 | }; | ||
| 30 | const T1 = S.Foo(@src()); | ||
| 31 | const T2 = S.Foo(@src()); | ||
| 32 | try expect(T1 != T2); | ||
| 33 | } |