aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-11-29 18:40:28 +0200
committerVeikka Tuominen <git@vexu.eu>2022-11-29 21:44:08 +0200
commit6f5a438946dce2b201acf5b7bbe42977bc990cc4 (patch)
tree53e0290b28a6f8f6f070fb6cb08fb7ab9e7cc706 /test/behavior
parente60db701d13a50798222bbef2d4560245f975671 (diff)
downloadzig-6f5a438946dce2b201acf5b7bbe42977bc990cc4.tar.gz
zig-6f5a438946dce2b201acf5b7bbe42977bc990cc4.zip
AstGen: unstack block scope when creating opaque type
Closes #13697
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/basic.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
index 7351891959..3fc1cda04d 100644
--- a/test/behavior/basic.zig
+++ b/test/behavior/basic.zig
@@ -1127,3 +1127,14 @@ test "pointer to zero sized global is mutable" {
};
try expect(@TypeOf(&S.thing) == *S.Thing);
}
+
+test "returning an opaque type from a function" {
+ const S = struct {
+ fn foo(comptime a: u32) type {
+ return opaque {
+ const b = a;
+ };
+ }
+ };
+ try expect(S.foo(123).b == 123);
+}