diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-09-30 15:44:28 +0300 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-01-03 18:38:15 +0200 |
| commit | abd005f302ee81213b3f3a97a08d025cb3b1ecee (patch) | |
| tree | fa30badad6a8e4e8af338e33fea1fb35e3c427e0 /test/cases/compile_errors/generic_instantiation_failure.zig | |
| parent | daeb992c7346cf3ecaca9e0bcbee20737b005eaa (diff) | |
| download | zig-abd005f302ee81213b3f3a97a08d025cb3b1ecee.tar.gz zig-abd005f302ee81213b3f3a97a08d025cb3b1ecee.zip | |
Sema: do not immediately destroy failed generic instantiation
Closes #12535
Closes #12765
Closes #12927
Diffstat (limited to 'test/cases/compile_errors/generic_instantiation_failure.zig')
| -rw-r--r-- | test/cases/compile_errors/generic_instantiation_failure.zig | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/cases/compile_errors/generic_instantiation_failure.zig b/test/cases/compile_errors/generic_instantiation_failure.zig new file mode 100644 index 0000000000..42e4c4e8c8 --- /dev/null +++ b/test/cases/compile_errors/generic_instantiation_failure.zig @@ -0,0 +1,27 @@ +fn List(comptime Head: type, comptime Tail: type) type { + return union { + const Self = @This(); + head: Head, + tail: Tail, + + fn AppendReturnType(comptime item: anytype) type { + return List(Head, List(@TypeOf(item), void)); + } + }; +} + +fn makeList(item: anytype) List(@TypeOf(item), void) { + return List(@TypeOf(item), void){ .head = item }; +} + +pub export fn entry() void { + @TypeOf(makeList(42)).AppendReturnType(64); +} + +// error +// backend=llvm +// target=native +// +// :18:43: error: value of type 'type' ignored +// :18:43: note: all non-void values must be used +// :18:43: note: this error can be suppressed by assigning the value to '_' |
