| author | |
| committer | |
| log | 589e564f16fd9c07dde9ae88910219d25b7a377f |
| tree | 137136134398468f288f100acda9193b5c2b285a |
| parent | 2e3fac3626a3edc61eb8afc7c17a19b5fec4b672 |
| signature |
generic_function_returning_opaque_type.zig was salvaged as it's still worth
having.9 files changed, 16 insertions(+), 90 deletions(-)
test/cases/README.md-1| ... | ... | @@ -84,6 +84,5 @@ path will be prepended as a prefix on the test case name. |
| 84 | 84 | Possible backends are: |
| 85 | 85 | |
| 86 | 86 | * `auto`: the default; compiler picks the backend based on robustness. |
| 87 | * `stage1`: equivalent to `-fstage1`. | |
| 88 | 87 | * `selfhosted`: equivalent to passing `-fno-llvm -fno-lld`. |
| 89 | 88 | * `llvm`: equivalent to `-fllvm`. |
test/cases/compile_errors/generic_function_returning_opaque_type.zig created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | fn generic(comptime T: type) T { | |
| 2 | return undefined; | |
| 3 | } | |
| 4 | const MyOpaque = opaque {}; | |
| 5 | export fn foo() void { | |
| 6 | _ = generic(MyOpaque); | |
| 7 | } | |
| 8 | export fn bar() void { | |
| 9 | _ = generic(anyopaque); | |
| 10 | } | |
| 11 | ||
| 12 | // error | |
| 13 | // | |
| 14 | // :1:30: error: opaque return type 'tmp.MyOpaque' not allowed | |
| 15 | // :4:18: note: opaque declared here | |
| 16 | // :1:30: error: opaque return type 'anyopaque' not allowed |
test/cases/compile_errors/stage1/obj/call_with_new_stack_on_unsupported_target.zig deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | var buf: [10]u8 align(16) = undefined; | |
| 2 | export fn entry() void { | |
| 3 | @call(.{ .stack = &buf }, foo, .{}); | |
| 4 | } | |
| 5 | fn foo() void {} | |
| 6 | ||
| 7 | // error | |
| 8 | // backend=stage1 | |
| 9 | // target=wasm32-wasi-none | |
| 10 | // | |
| 11 | // tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack |
test/cases/compile_errors/stage1/obj/generic_fn_as_parameter_without_comptime_keyword.zig deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | fn f(_: fn (anytype) void) void {} | |
| 2 | fn g(_: anytype) void {} | |
| 3 | export fn entry() void { | |
| 4 | f(g); | |
| 5 | } | |
| 6 | ||
| 7 | // error | |
| 8 | // backend=stage1 | |
| 9 | // target=native | |
| 10 | // | |
| 11 | // tmp.zig:1:9: error: parameter of type 'fn (anytype) anytype' must be declared comptime |
test/cases/compile_errors/stage1/obj/generic_function_returning_opaque_type.zig deleted-25| ... | ... | @@ -1,25 +0,0 @@ |
| 1 | const FooType = opaque {}; | |
| 2 | fn generic(comptime T: type) !T { | |
| 3 | return undefined; | |
| 4 | } | |
| 5 | export fn bar() void { | |
| 6 | _ = generic(FooType); | |
| 7 | } | |
| 8 | export fn bav() void { | |
| 9 | _ = generic(@TypeOf(null)); | |
| 10 | } | |
| 11 | export fn baz() void { | |
| 12 | _ = generic(@TypeOf(undefined)); | |
| 13 | } | |
| 14 | ||
| 15 | // error | |
| 16 | // backend=stage1 | |
| 17 | // target=native | |
| 18 | // | |
| 19 | // tmp.zig:6:16: error: call to generic function with Opaque return type 'FooType' not allowed | |
| 20 | // tmp.zig:2:1: note: function declared here | |
| 21 | // tmp.zig:1:1: note: type declared here | |
| 22 | // tmp.zig:9:16: error: call to generic function with Null return type '@Type(.Null)' not allowed | |
| 23 | // tmp.zig:2:1: note: function declared here | |
| 24 | // tmp.zig:12:16: error: call to generic function with Undefined return type '@Type(.Undefined)' not allowed | |
| 25 | // tmp.zig:2:1: note: function declared here |
test/cases/compile_errors/stage1/obj/generic_function_where_return_type_is_self-referenced.zig deleted-13| ... | ... | @@ -1,13 +0,0 @@ |
| 1 | fn Foo(comptime T: type) Foo(T) { | |
| 2 | return struct { x: T }; | |
| 3 | } | |
| 4 | export fn entry() void { | |
| 5 | const t = Foo(u32){ .x = 1 }; | |
| 6 | _ = t; | |
| 7 | } | |
| 8 | ||
| 9 | // error | |
| 10 | // backend=stage1 | |
| 11 | // target=native | |
| 12 | // | |
| 13 | // tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches |
test/cases/compile_errors/stage1/obj/unsupported_modifier_at_start_of_asm_output_constraint.zig deleted-14| ... | ... | @@ -1,14 +0,0 @@ |
| 1 | export fn foo() void { | |
| 2 | var bar: u32 = 3; | |
| 3 | asm volatile ("" | |
| 4 | : [baz] "+r" (bar), | |
| 5 | : | |
| 6 | : "" | |
| 7 | ); | |
| 8 | } | |
| 9 | ||
| 10 | // error | |
| 11 | // backend=stage1 | |
| 12 | // target=native | |
| 13 | // | |
| 14 | // tmp.zig:3:5: error: invalid modifier starting output constraint for 'baz': '+', only '=' is supported. Compiler TODO: see https://github.com/ziglang/zig/issues/215 |
test/cases/compile_errors/stage1/obj/variable_in_inline_assembly_template_cannot_be_found.zig deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | var sp = asm volatile ("mov %[foo], sp" | |
| 3 | : [bar] "=r" (-> usize), | |
| 4 | ); | |
| 5 | _ = &sp; | |
| 6 | } | |
| 7 | ||
| 8 | // error | |
| 9 | // backend=stage1 | |
| 10 | // target=x86_64-linux-gnu | |
| 11 | // | |
| 12 | // tmp.zig:2:14: error: could not find 'foo' in the inputs or outputs |
test/src/Cases.zig-3| ... | ... | @@ -28,7 +28,6 @@ pub const DepModule = struct { |
| 28 | 28 | pub const Backend = enum { |
| 29 | 29 | /// Test does not care which backend is used; compiler gets to pick the default. |
| 30 | 30 | auto, |
| 31 | stage1, | |
| 32 | 31 | selfhosted, |
| 33 | 32 | llvm, |
| 34 | 33 | }; |
| ... | ... | @@ -623,7 +622,6 @@ pub fn lowerToBuildSteps( |
| 623 | 622 | const would_use_llvm = @import("../tests.zig").wouldUseLlvm( |
| 624 | 623 | switch (case.backend) { |
| 625 | 624 | .auto => null, |
| 626 | .stage1 => continue, | |
| 627 | 625 | .selfhosted => false, |
| 628 | 626 | .llvm => true, |
| 629 | 627 | }, |
| ... | ... | @@ -699,7 +697,6 @@ pub fn lowerToBuildSteps( |
| 699 | 697 | |
| 700 | 698 | switch (case.backend) { |
| 701 | 699 | .auto => {}, |
| 702 | .stage1 => continue, | |
| 703 | 700 | .selfhosted => { |
| 704 | 701 | artifact.use_llvm = false; |
| 705 | 702 | artifact.use_lld = false; |