diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-11-25 02:40:06 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-11-26 18:05:27 +0200 |
| commit | 587ef60a28ae7c1c780e02ecf60b331ead53bc7f (patch) | |
| tree | b9a13a178108717bc40a5bb042beb79f95bf2a91 /test | |
| parent | bf62cb453bb1e91cd0ed448de70bd4f076b81906 (diff) | |
| download | zig-587ef60a28ae7c1c780e02ecf60b331ead53bc7f.tar.gz zig-587ef60a28ae7c1c780e02ecf60b331ead53bc7f.zip | |
Sema: resolve union fields before using getTagType
Closes #13649
Diffstat (limited to 'test')
| -rw-r--r-- | test/cases/compile_errors/union_fields_are_resolved_before_tag_type_is_needed.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/cases/compile_errors/union_fields_are_resolved_before_tag_type_is_needed.zig b/test/cases/compile_errors/union_fields_are_resolved_before_tag_type_is_needed.zig new file mode 100644 index 0000000000..7ef4c80d5a --- /dev/null +++ b/test/cases/compile_errors/union_fields_are_resolved_before_tag_type_is_needed.zig @@ -0,0 +1,16 @@ +const T = union(enum) { + a, + pub fn f(self: T) void { + _ = self; + } +}; +pub export fn entry() void { + T.a.f(); +} + +// error +// backend=stage2 +// target=native +// +// :8:8: error: no field or member function named 'f' in '@typeInfo(tmp.T).Union.tag_type.?' +// :1:11: note: enum declared here |
