diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-03-05 07:22:47 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-03-06 21:26:38 +0000 |
| commit | 2c4ac44f25743f5b7ae9db6bc570ab71f15fd83b (patch) | |
| tree | 5936a2c47c13ea1fcd5bd37ce523754517be38cf /lib/std/json/stringify_test.zig | |
| parent | d0c022f7347b5cda34751a986a535aee3b1f45dc (diff) | |
| download | zig-2c4ac44f25743f5b7ae9db6bc570ab71f15fd83b.tar.gz zig-2c4ac44f25743f5b7ae9db6bc570ab71f15fd83b.zip | |
compiler: treat decl_val/decl_ref of potentially generic decls as captures
This fixes an issue with the implementation of #18816. Consider the
following code:
```zig
pub fn Wrap(comptime T: type) type {
return struct {
pub const T1 = T;
inner: struct { x: T1 },
};
}
```
Previously, the type of `inner` was not considered to be "capturing" any
value, as `T1` is a decl. However, since it is declared within a generic
function, this decl reference depends on the context, and thus should be
treated as a capture.
AstGen has been augmented to tunnel references to decls through closure
when the decl was declared in a potentially-generic context (i.e. within
a function).
Diffstat (limited to 'lib/std/json/stringify_test.zig')
0 files changed, 0 insertions, 0 deletions
