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

Import statement is not inserted when only a enum is used. #780

Closed
KOLANICH opened this issue Jul 21, 2020 · 4 comments
Closed

Import statement is not inserted when only a enum is used. #780

KOLANICH opened this issue Jul 21, 2020 · 4 comments

Comments

@KOLANICH
Copy link

To reproduce compile bluetooth_hcd from kaitai-io/kaitai_struct_formats#305 and see that https://github.com/kaitai-io/kaitai_struct_formats/pull/305/files#diff-d5dc77b92e2d98a1f9ab5b90cbdb3fe4R21 doesn't cause BluetoothVendorsIds be imported.

@dgelessus
Copy link
Contributor

I'm not sure, but this might be the same problem as #651.

@KOLANICH
Copy link
Author

That one errors in transpile time. This one errors in run time (at least for python).

@generalmimon
Copy link
Member

Actually, it's a duplicate of #703 (comment). It seems that it doesn't matter if you reference a nested user-type or a nested enum type from the imported spec. I'll try to solve it in the near future.

I'm not sure, but this might be the same problem as #651.

Thanks for pointing out issue #651, I didn't know about it (most likely because I often filter the issues by label "bug found", but that issue didn't have it until now). Yeah, it seems like the same problem as well.

That one errors in transpile time. This one errors in run time (at least for python).

Apparently not anymore, you can see on the timeline of issue #651 that commit kaitai-io/kaitai_struct_compiler@5d4881a solved the problem with the compiler failing to generate the parser. Now it really fails only at run time, as you can see in the CI dashboard (search for test EnumImport that demonstrates the problem - here's the enum_import.ksy). In Python it currently fails with NameError: global name 'Enum0' is not defined, which again points to the missing import.

@generalmimon
Copy link
Member

Duplicate of #651

@generalmimon generalmimon marked this as a duplicate of #651 Mar 21, 2024
@generalmimon generalmimon closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2024
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