From 67b4de33d2729fdb21337e5a0e05f6273bce23ba Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 2 Mar 2019 10:38:27 -0500 Subject: compile error for import outside package path closes #2024 there's a new cli option `--main-pkg-path` which you can use to choose a different root package directory besides the one inferred from the root source file and a corresponding build.zig API: foo.setMainPkgPath(path) --- src/analyze.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index 089f72483f..30e147c62d 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -4502,6 +4502,9 @@ ZigType *add_source_file(CodeGen *g, ZigPackage *package, Buf *resolved_path, Bu Buf *pkg_root_src_dir = &package->root_src_dir; Buf resolved_root_src_dir = os_path_resolve(&pkg_root_src_dir, 1); + + assert(buf_starts_with_buf(resolved_path, &resolved_root_src_dir)); + Buf namespace_name = BUF_INIT; buf_init_from_buf(&namespace_name, &package->pkg_path); if (source_kind == SourceKindNonRoot) { -- cgit v1.2.3