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
This one's pretty obscure, but there's definitely a bug here.
The compiler seems to have some logic to check if a type is used in multiple locations to determine whether the parent is a known type or whether it should just a a generic KaitaiStruct type. (ClassCompiler.scala@markupParentTypes)
This check doesn't check the usages of the type inside instances. If only one type uses it in the seq section, but other types use it in the instances section, the resulting output won't compile.
I tried to fix this one by adding to markupParentTypes, but I couldn't work it out (I'm not familiar enough with the type system yet).
KSY to replicate the bug:
meta:
id: multiple_useendian: leseq:
- id: t1type: type_1
- id: t2type: type_2types:
multi:
seq:
- id: valuetype: s4type_1:
seq:
- id: first_usetype: multi # parent type = type_1type_2:
seq: []instances:
second_use:
pos: 0type: multi # parent type = type_2
Compiled result (similar problems in both C# and Java):
// Error CS1503 - Argument 2: cannot convert from 'MultipleUse.Type2' to 'MultipleUse.Type1'classMultipleUse:KaitaiStruct{
...// Note here that `parent` is `Type1`. It should be `KaitaiStruct`.classMulti:KaitaiStruct{publicMulti(KaitaiStreamio,Type1parent=null,MultipleUseroot=null):base(io){ ...}}classType1:KaitaiStruct{
...privatevoid_parse(){_firstUse=new Multi(m_io,this, m_root);}}classType2:KaitaiStruct{publicMultiSecondUse{get{
...
_secondUse =new Multi(m_io,this, m_root);// <--- compile error here
...}}}}
Temporary work around:
# Add this to `seq`:
- id: unusedtype: multiif: false
The text was updated successfully, but these errors were encountered:
Tests for everything beside C++ (not working now, need more namespacing tweaks) and PHP (under development anyway) are ready and passing - see http://kaitai.io/ci/ - I guess I'm closing this one as solved.
This one's pretty obscure, but there's definitely a bug here.
The compiler seems to have some logic to check if a type is used in multiple locations to determine whether the parent is a known type or whether it should just a a generic
KaitaiStruct
type. (ClassCompiler.scala@markupParentTypes
)This check doesn't check the usages of the type inside instances. If only one type uses it in the
seq
section, but other types use it in theinstances
section, the resulting output won't compile.I tried to fix this one by adding to
markupParentTypes
, but I couldn't work it out (I'm not familiar enough with the type system yet).KSY to replicate the bug:
Compiled result (similar problems in both C# and Java):
Temporary work around:
The text was updated successfully, but these errors were encountered: