aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2019-05-21 17:07:40 +0200
committerLemonBoy <thatlemon@gmail.com>2019-05-21 17:07:40 +0200
commitf67ca206557de58df91011744f656ed049d36372 (patch)
tree0ccf3a4ac7da25a0330cdebe5f8058a9b075be6b /test
parent163a8e98bc04ea955ee54d5905436ffac34c93a2 (diff)
downloadzig-f67ca206557de58df91011744f656ed049d36372.tar.gz
zig-f67ca206557de58df91011744f656ed049d36372.zip
Make use work with arbitrary structs
Diffstat (limited to 'test')
-rw-r--r--test/stage1/behavior/struct.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/stage1/behavior/struct.zig b/test/stage1/behavior/struct.zig
index c38359be24..d7bbee5d15 100644
--- a/test/stage1/behavior/struct.zig
+++ b/test/stage1/behavior/struct.zig
@@ -549,3 +549,14 @@ test "packed struct with fp fields" {
expectEqual(f32(11.0), s.data[1]);
expectEqual(f32(20.0), s.data[2]);
}
+
+test "use within struct scope" {
+ const S = struct {
+ use struct {
+ pub fn inner() i32 {
+ return 42;
+ }
+ };
+ };
+ expectEqual(i32(42), S.inner());
+}