From f72c36cd37a383ca7ca9e09cb6a665dfe2c73365 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 1 Mar 2016 17:59:56 -0700 Subject: fix detection of @import and @c_import inside fn body --- test/run_tests.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/run_tests.cpp') diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 34d4e46792..92622b7027 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1764,6 +1764,12 @@ fn f(n: Number) -> i32 { } } )SOURCE", 1, ".tmp_source.zig:9:5: error: enumeration value 'Four' not handled in switch"); + + add_compile_fail_case("import inside function body", R"SOURCE( +fn f() { + const std = @import("std"); +} + )SOURCE", 1, ".tmp_source.zig:3:17: error: @import invalid inside function bodies"); } ////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3