introduce @hasDecl builtin function

closes #1439
This commit is contained in:
Andrew Kelley
2019-05-26 16:21:03 -04:00
parent 21ed939117
commit 269a53b6af
9 changed files with 149 additions and 0 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(
"@hasDecl with non-container",
\\export fn entry() void {
\\ _ = @hasDecl(i32, "hi");
\\}
,
"tmp.zig:2:18: error: expected struct, enum, or union; found 'i32'",
);
cases.add(
"field access of slices",
\\export fn entry() void {