mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
test: delete old stage1 compile_errors tests
generic_function_returning_opaque_type.zig was salvaged as it's still worth having.
This commit is contained in:
parent
2e3fac3626
commit
589e564f16
9 changed files with 16 additions and 90 deletions
|
|
@ -84,6 +84,5 @@ path will be prepended as a prefix on the test case name.
|
|||
Possible backends are:
|
||||
|
||||
* `auto`: the default; compiler picks the backend based on robustness.
|
||||
* `stage1`: equivalent to `-fstage1`.
|
||||
* `selfhosted`: equivalent to passing `-fno-llvm -fno-lld`.
|
||||
* `llvm`: equivalent to `-fllvm`.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
fn generic(comptime T: type) T {
|
||||
return undefined;
|
||||
}
|
||||
const MyOpaque = opaque {};
|
||||
export fn foo() void {
|
||||
_ = generic(MyOpaque);
|
||||
}
|
||||
export fn bar() void {
|
||||
_ = generic(anyopaque);
|
||||
}
|
||||
|
||||
// error
|
||||
//
|
||||
// :1:30: error: opaque return type 'tmp.MyOpaque' not allowed
|
||||
// :4:18: note: opaque declared here
|
||||
// :1:30: error: opaque return type 'anyopaque' not allowed
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
var buf: [10]u8 align(16) = undefined;
|
||||
export fn entry() void {
|
||||
@call(.{ .stack = &buf }, foo, .{});
|
||||
}
|
||||
fn foo() void {}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=wasm32-wasi-none
|
||||
//
|
||||
// tmp.zig:3:5: error: target arch 'wasm32' does not support calling with a new stack
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
fn f(_: fn (anytype) void) void {}
|
||||
fn g(_: anytype) void {}
|
||||
export fn entry() void {
|
||||
f(g);
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:1:9: error: parameter of type 'fn (anytype) anytype' must be declared comptime
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
const FooType = opaque {};
|
||||
fn generic(comptime T: type) !T {
|
||||
return undefined;
|
||||
}
|
||||
export fn bar() void {
|
||||
_ = generic(FooType);
|
||||
}
|
||||
export fn bav() void {
|
||||
_ = generic(@TypeOf(null));
|
||||
}
|
||||
export fn baz() void {
|
||||
_ = generic(@TypeOf(undefined));
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:6:16: error: call to generic function with Opaque return type 'FooType' not allowed
|
||||
// tmp.zig:2:1: note: function declared here
|
||||
// tmp.zig:1:1: note: type declared here
|
||||
// tmp.zig:9:16: error: call to generic function with Null return type '@Type(.Null)' not allowed
|
||||
// tmp.zig:2:1: note: function declared here
|
||||
// tmp.zig:12:16: error: call to generic function with Undefined return type '@Type(.Undefined)' not allowed
|
||||
// tmp.zig:2:1: note: function declared here
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
fn Foo(comptime T: type) Foo(T) {
|
||||
return struct { x: T };
|
||||
}
|
||||
export fn entry() void {
|
||||
const t = Foo(u32){ .x = 1 };
|
||||
_ = t;
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// tmp.zig:1:29: error: evaluation exceeded 1000 backwards branches
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
export fn foo() void {
|
||||
var bar: u32 = 3;
|
||||
asm volatile (""
|
||||
: [baz] "+r" (bar),
|
||||
:
|
||||
: ""
|
||||
);
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=native
|
||||
//
|
||||
// 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
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
export fn entry() void {
|
||||
var sp = asm volatile ("mov %[foo], sp"
|
||||
: [bar] "=r" (-> usize),
|
||||
);
|
||||
_ = &sp;
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage1
|
||||
// target=x86_64-linux-gnu
|
||||
//
|
||||
// tmp.zig:2:14: error: could not find 'foo' in the inputs or outputs
|
||||
|
|
@ -28,7 +28,6 @@ pub const DepModule = struct {
|
|||
pub const Backend = enum {
|
||||
/// Test does not care which backend is used; compiler gets to pick the default.
|
||||
auto,
|
||||
stage1,
|
||||
selfhosted,
|
||||
llvm,
|
||||
};
|
||||
|
|
@ -623,7 +622,6 @@ pub fn lowerToBuildSteps(
|
|||
const would_use_llvm = @import("../tests.zig").wouldUseLlvm(
|
||||
switch (case.backend) {
|
||||
.auto => null,
|
||||
.stage1 => continue,
|
||||
.selfhosted => false,
|
||||
.llvm => true,
|
||||
},
|
||||
|
|
@ -699,7 +697,6 @@ pub fn lowerToBuildSteps(
|
|||
|
||||
switch (case.backend) {
|
||||
.auto => {},
|
||||
.stage1 => continue,
|
||||
.selfhosted => {
|
||||
artifact.use_llvm = false;
|
||||
artifact.use_lld = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue