Skip to content

Commit

Permalink
Fix incorrect reported path for switch types when validating types
Browse files Browse the repository at this point in the history
This change requires corresponding change in kaitai_struct_tests repository

Partially fixes the following error (the first line):
```
[info] - attr_invalid_switch_inner *** FAILED ***
[info]   attr_invalid_switch_inner.ksy: /seq/1/type/cases/IntNum(42)/size:
[info]   	error: invalid type: expected integer, got CalcBooleanType
[info]
[info]   attr_invalid_switch_inner.ksy: /seq/1/type/cases/Name(identifier(_))/size:
[info]   	error: invalid type: expected integer, got CalcBooleanType
[info]    did not equal attr_invalid_switch_inner.ksy: /seq/1/size:
[info]   	error: invalid type: expected integer, got CalcBooleanType (SimpleMatchers.scala:34)
```
  • Loading branch information
Mingun committed Mar 21, 2024
1 parent c03696c commit c21d54d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ class TypeValidator(specs: ClassSpecs) extends PrecompileStep {
} else {
None
}
val problems2 = validateDataType(caseType, casePath)
// All properties of types is declared on the common level for all variants so
// we don't use `casePath` here
// FIXME: We need to filter repeated errors here, because some errors influences
// many cases
val problems2 = validateDataType(caseType, path)
problems1 ++ problems2
}
}
Expand Down

0 comments on commit c21d54d

Please sign in to comment.