From 77cc09f48ebde7f51fb40b0ddc541cd04ed3c8b7 Mon Sep 17 00:00:00 2001 From: Mingun Date: Fri, 22 Mar 2024 21:03:36 +0500 Subject: [PATCH] Use filename (which fallback to root type name) in locations of import messages Fixes the test: ``` [info] - meta_imports_abs_unknown *** FAILED *** [info] meta_imports_abs_unknown: /meta/imports/0: [info] error: unable to find 'unknown_absolute_name.ksy' in import search paths, using: List() [info] did not equal meta_imports_abs_unknown.ksy: /meta/imports/0: [info] error: unable to find 'unknown_absolute_name.ksy' in import search paths, using: List() (SimpleMatchers.scala:34) ``` Changes filename in the following tests: ``` [info] - meta_imports_rel2 *** FAILED *** [info] meta_imports_rel_unknown: /meta/imports/0: [info] error: unknown_relative_name.ksy (No such file or directory) [info] did not equal meta_imports_rel_unknown: /meta/imports/0: [info] error: ../tests/formats_err/unknown_relative_name.ksy (No such file or directory) (SimpleMatchers.scala:34) [info] - meta_imports_rel_unknown *** FAILED *** [info] meta_imports_rel_unknown: /meta/imports/0: [info] error: unknown_relative_name.ksy (No such file or directory) [info] did not equal meta_imports_rel_unknown: /meta/imports/0: [info] error: ../tests/formats_err/unknown_relative_name.ksy (No such file or directory) (SimpleMatchers.scala:34) ``` --- .../main/scala/io/kaitai/struct/precompile/LoadImports.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/io/kaitai/struct/precompile/LoadImports.scala b/shared/src/main/scala/io/kaitai/struct/precompile/LoadImports.scala index 084df223e..d25bfeb9b 100644 --- a/shared/src/main/scala/io/kaitai/struct/precompile/LoadImports.scala +++ b/shared/src/main/scala/io/kaitai/struct/precompile/LoadImports.scala @@ -32,7 +32,7 @@ class LoadImports(specs: ClassSpecs) { loadImport( name, curClass.meta.path ++ List("imports", idx.toString), - Some(curClass.nameAsStr), + Some(curClass.fileNameAsStr), workDir ) }).map((x) => x.flatten)