-
Notifications
You must be signed in to change notification settings - Fork 204
Description
Using kaitai-struct-compiler 0.9-SNAPSHOT501381150.
It seems that specs imported by one spec are also implicitly imported for all other specs. This can lead to an imported spec compiling even though it doesn't import all needed types (because the only places that use it happen to also import the necessary types). Short example:
one.ksy:
meta:
id: one
seq:
- id: something
size: 4two.ksy:
meta:
id: two
# Note: missing import of `one`
seq:
- id: one_thing
type: one # Note: `one` is not imported in this spec, so this should cause a compile errortoplevel.ksy:
meta:
id: toplevel
imports:
- one
- two
seq:
- id: another_one
type: one
- id: another_two
type: twoone.ksy is valid. two.ksy is invalid (because it uses one without importing it) and does not compile. toplevel.ksy itself is valid, but it imports the invalid two.ksy. Despite this, compiling toplevel.ksy does not produce an error, because toplevel's import of one leaks into two. (If you remove the usage of one from toplevel.ksy, it will fail to compile, because then two cannot find the required one type anymore.)
Real example: kaitai-io/kaitai_struct_formats#126 (review)