fixups and add documentation for @Type

This commit is contained in:
Andrew Kelley
2019-09-04 11:08:28 -04:00
parent b728cb6d4e
commit ac7703f65f
7 changed files with 130 additions and 49 deletions

View File

@@ -2,6 +2,15 @@ const tests = @import("tests.zig");
const builtin = @import("builtin");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
"attempt to create 17 bit float type",
\\const builtin = @import("builtin");
\\comptime {
\\ _ = @Type(builtin.TypeInfo { .Float = builtin.TypeInfo.Float { .bits = 17 } });
\\}
,
"tmp.zig:3:32: error: 17-bit float unsupported",
);
cases.add(
"wrong type for @Type",
@@ -45,15 +54,6 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
"tmp.zig:2:15: error: @Type not availble for 'TypeInfo.Struct'",
);
cases.add(
"array not implemented for @Type",
\\export fn entry() void {
\\ _ = @Type(@typeInfo(enum{x}));
\\}
,
"tmp.zig:2:15: error: TODO implement @Type forr 'TypeInfo.Enum': see https://github.com/ziglang/zig/issues/2907",
);
cases.add(
"wrong type for result ptr to @asyncCall",
\\export fn entry() void {