Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referencing an enum of an imported spec doesn't work in some languages #651

Closed
eric-corumdigital opened this issue Dec 9, 2019 · 2 comments
Milestone

Comments

@eric-corumdigital
Copy link

eric-corumdigital commented Dec 9, 2019

OS: Windows
KSC: kaitai-struct-compiler 0.9-SNAPSHOT

my_enum.ksy

meta:
  id: my_enum

enums:
  t:
    0: x

my_type.ksy

meta:
  id: my_type
  imports:
    - my_enum

seq:
  - id: my_field
    type: u1
    enum: my_enum::t
>kaitai-struct-compiler -t javascript my_type.ksy
/seq/0: unable to find enum 'my_enum::t', searching from my_type
GreyCat added a commit to kaitai-io/kaitai_struct_tests that referenced this issue Dec 9, 2019
GreyCat added a commit to kaitai-io/kaitai_struct_compiler that referenced this issue Dec 9, 2019
@GreyCat
Copy link
Member

GreyCat commented Dec 9, 2019

Initial solution seems to be checked in, along with the test that reproduces the problem. Unfortunately, it's still not a solution, as it looks like different languages have some other problems in adoption of such constructs. Only Ruby seems to pass so far.

@generalmimon generalmimon changed the title unable to find enum Using an enum from an imported spec doesn't work in some languages Mar 2, 2024
@generalmimon generalmimon changed the title Using an enum from an imported spec doesn't work in some languages Referencing an enum of an imported spec doesn't work in some languages Mar 2, 2024
@generalmimon
Copy link
Member

This has been resolved recently. The relevant test is called EnumImportSeq (previously just EnumImport). Check the CI dashboard - this test now passes in all targets except Construct (which doesn't support imports yet; kaitai-io/kaitai_struct_compiler#242 apparently attempts to add it).

The main general problem was that the compiler didn't generate imports for imported enums. This was solved in commit kaitai-io/kaitai_struct_compiler@bb53205, which fixed EnumImportSeq for C++ and Perl. In Python, references to external enums were also incorrect, which was fixed in commit kaitai-io/kaitai_struct_compiler@e4aebb8.

@generalmimon generalmimon added this to the v0.11 milestone Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants