mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
Address Spaces: Adapt compile error test cases to @Type with address spaces
This commit is contained in:
parent
c5945467ac
commit
7956eee1ab
@ -410,7 +410,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
\\ .Fn = .{
|
||||
\\ .calling_convention = .Unspecified,
|
||||
\\ .alignment = 0,
|
||||
\\ .address_space = 0,
|
||||
\\ .address_space = .generic,
|
||||
\\ .is_generic = true,
|
||||
\\ .is_var_args = false,
|
||||
\\ .return_type = u0,
|
||||
@ -427,7 +427,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
\\ .Fn = .{
|
||||
\\ .calling_convention = .Unspecified,
|
||||
\\ .alignment = 0,
|
||||
\\ .address_space = 0,
|
||||
\\ .address_space = .generic,
|
||||
\\ .is_generic = false,
|
||||
\\ .is_var_args = true,
|
||||
\\ .return_type = u0,
|
||||
@ -444,7 +444,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
\\ .Fn = .{
|
||||
\\ .calling_convention = .Unspecified,
|
||||
\\ .alignment = 0,
|
||||
\\ .address_space = 0,
|
||||
\\ .address_space = .generic,
|
||||
\\ .is_generic = false,
|
||||
\\ .is_var_args = false,
|
||||
\\ .return_type = null,
|
||||
@ -456,6 +456,23 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
"tmp.zig:1:20: error: TypeInfo.Fn.return_type must be non-null for @Type",
|
||||
});
|
||||
|
||||
ctx.objErrStage1("@Type(.Fn) with invalid address space ",
|
||||
\\const Foo = @Type(.{
|
||||
\\ .Fn = .{
|
||||
\\ .calling_convention = .Unspecified,
|
||||
\\ .alignment = 0,
|
||||
\\ .address_space = .fs,
|
||||
\\ .is_generic = false,
|
||||
\\ .is_var_args = false,
|
||||
\\ .return_type = u0,
|
||||
\\ .args = &[_]@import("std").builtin.TypeInfo.FnArg{},
|
||||
\\ },
|
||||
\\});
|
||||
\\comptime { _ = Foo; }
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:1:20: error: address space 'fs' not available in stage 1 compiler, must be .generic",
|
||||
});
|
||||
|
||||
ctx.objErrStage1("@Type for union with opaque field",
|
||||
\\const TypeInfo = @import("std").builtin.TypeInfo;
|
||||
\\const Untagged = @Type(.{
|
||||
@ -724,6 +741,23 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
"tmp.zig:2:16: error: sentinels are only allowed on slices and unknown-length pointers",
|
||||
});
|
||||
|
||||
ctx.objErrStage1("@Type(.Pointer) with invalid address space ",
|
||||
\\export fn entry() void {
|
||||
\\ _ = @Type(.{ .Pointer = .{
|
||||
\\ .size = .One,
|
||||
\\ .is_const = false,
|
||||
\\ .is_volatile = false,
|
||||
\\ .alignment = 1,
|
||||
\\ .address_space = .gs,
|
||||
\\ .child = u8,
|
||||
\\ .is_allowzero = false,
|
||||
\\ .sentinel = null,
|
||||
\\ }});
|
||||
\\}
|
||||
, &[_][]const u8{
|
||||
"tmp.zig:2:16: error: address space 'gs' not available in stage 1 compiler, must be .generic",
|
||||
});
|
||||
|
||||
ctx.testErrStage1("helpful return type error message",
|
||||
\\export fn foo() u32 {
|
||||
\\ return error.Ohno;
|
||||
|
Loading…
Reference in New Issue
Block a user