You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kaitai-struct-compiler-0.10 -- --verbose file -t all -d outdir-rel nested_types_paths_rel.ksy
kaitai-struct-compiler-0.10 -- --verbose file -t all -d outdir-abs nested_types_paths_abs.ksy
and compare the generated modules, only the type reference should be different, if anything. Unfortunately, a few more incorrect changes occur:
In some target languages, the generated code refers to the top-level type itself, without actually resolving the full type path (note that the snippets below are not full diffs, only cherry-picked relevant parts):
--- 1/outdir-rel/ruby/nested_types_paths.rb+++ 2/outdir-abs/ruby/nested_types_paths.rb@@ -23,7 +23,7 @@ class NestedTypesPaths < Kaitai::Struct::Struct
end
def _read
- @obj_cd = C::D.new(@_io, self, @_root)+ @obj_cd = NestedTypesPaths::C::D.new(@_io)
self
end
attr_reader :obj_cd
In all typed languages, the _parent type of the nested_types_paths::c::d class changes from nested_types_paths::a to a generic KaitaiStruct (again, here are only cherry-picked parts of the full diffs):
diff --git 1/outdir-rel/php/NestedTypesPaths.php 2/outdir-abs/php/NestedTypesPaths.php
index 55382ec..dae0bcd 100644
--- 1/outdir-rel/php/NestedTypesPaths.php+++ 2/outdir-abs/php/NestedTypesPaths.php@@ -45,7 +45,7 @@ namespace NestedTypesPaths {
namespace NestedTypesPaths\C {
class D extends \Kaitai\Struct\Struct {
- public function __construct(\Kaitai\Struct\Stream $_io, \NestedTypesPaths\A $_parent = null, \NestedTypesPaths $_root = null) {+ public function __construct(\Kaitai\Struct\Stream $_io, \Kaitai\Struct\Struct $_parent = null, \NestedTypesPaths $_root = null) {
parent::__construct($_io, $_parent, $_root);
$this->_read();
}
On top of that, as @Mingun discovered in #921, KSC doesn't validate a nested type reference that begins with the root type and happily accepts type paths like type: nested_types_paths::xxx_does_not_exist without raising a compile error.
The text was updated successfully, but these errors were encountered:
In #1019 (comment), I mentioned that you should be able to qualify a type reference with the name of the top-level ("root") type:
It's not often done because it's redundant in this case (over just
type: c::d
), but there's no reason why it shouldn't work.However, some parts of the compiler apparently don't handle this properly. If we compile these two .ksy specs:
and compare the generated modules, only the type reference should be different, if anything. Unfortunately, a few more incorrect changes occur:
In some target languages, the generated code refers to the top-level type itself, without actually resolving the full type path (note that the snippets below are not full diffs, only cherry-picked relevant parts):
Construct
Go
Lua
Nim
Perl
PHP
Python
However, in other languages, it works as expected:
C++
C#
Java
JavaScript
Ruby
In all typed languages, the
_parent
type of thenested_types_paths::c::d
class changes fromnested_types_paths::a
to a genericKaitaiStruct
(again, here are only cherry-picked parts of the full diffs):C++
C#
Go
Java
Nim
PHP
On top of that, as @Mingun discovered in #921, KSC doesn't validate a nested type reference that begins with the root type and happily accepts type paths like
type: nested_types_paths::xxx_does_not_exist
without raising a compile error.The text was updated successfully, but these errors were encountered: