Partialy implement validation for valid key#307
Open
Mingun wants to merge 2 commits intokaitai-io:masterfrom
Open
Partialy implement validation for valid key#307Mingun wants to merge 2 commits intokaitai-io:masterfrom
valid key#307Mingun wants to merge 2 commits intokaitai-io:masterfrom
Conversation
fdbbdcf to
8792049
Compare
Fixed (4): ``` [info] - attr_bad_valid_expr *** FAILED *** [info] [] [info] did not equal [info] [attr_bad_valid_expr.ksy: /seq/0/valid/expr: [info] error: invalid type: expected boolean, got Int1Type(true) [info] ] (SimpleMatchers.scala:34) [info] - expr_field_unknown_valid_eq_long *** FAILED *** [info] [] [info] did not equal [info] [expr_field_unknown_valid_eq_long.ksy: /seq/0/valid/eq: [info] error: unable to access 'bar' in expr_field_unknown_valid_eq_long context [info] ] (SimpleMatchers.scala:34) [info] - expr_field_unknown_valid_expr *** FAILED *** [info] [] [info] did not equal [info] [expr_field_unknown_valid_expr.ksy: /seq/0/valid/expr: [info] error: unable to access 'bar' in expr_field_unknown_valid_expr context [info] ] (SimpleMatchers.scala:34) [info] - expr_field_unknown_valid_range *** FAILED *** [info] [] [info] did not equal [info] [expr_field_unknown_valid_range.ksy: /seq/0/valid/min: [info] error: unable to access 'bar' in expr_field_unknown_valid_range context [info] [info] expr_field_unknown_valid_range.ksy: /seq/0/valid/max: [info] error: unable to access 'qux' in expr_field_unknown_valid_range context [info] ] (SimpleMatchers.scala:34) ``` Changed error message (4, must correct model to distinguish between `valid` and `valid.eq`): ``` [info] - attr_bad_valid_eq_long *** FAILED *** [info] [attr_bad_valid_eq_long.ksy: /seq/0/valid/eq: [info] error: invalid type: expected Int1Type(false), got CalcStrType [info] ] [info] did not equal [info] [attr_bad_valid_eq_long.ksy: /seq/0/valid/eq: [info] error: can't compare Int1Type(false) and CalcStrType [info] ] (SimpleMatchers.scala:34) [info] - attr_bad_valid_eq_short *** FAILED *** [info] [attr_bad_valid_eq_short.ksy: /seq/0/valid/eq: [info] error: invalid type: expected Int1Type(false), got CalcStrType [info] ] [info] did not equal [info] [attr_bad_valid_eq_short.ksy: /seq/0/valid: [info] error: can't compare Int1Type(false) and CalcStrType [info] ] (SimpleMatchers.scala:34) [info] - attr_bad_valid_repeat_eq_short *** FAILED *** [info] [attr_bad_valid_repeat_eq_short.ksy: /seq/0/valid/eq: [info] error: invalid type: expected IntMultiType(true,Width4,Some(LittleEndian)), got ArrayTypeInStream(CalcIntType) [info] ] [info] did not equal [info] [attr_bad_valid_repeat_eq_short.ksy: /seq/0/valid: [info] error: can't compare IntMultiType(true,Width4,Some(LittleEndian)) and ArrayTypeInStream(CalcIntType) [info] ] (SimpleMatchers.scala:34) [info] - expr_field_unknown_valid_eq_short *** FAILED *** [info] [expr_field_unknown_valid_eq_short.ksy: /seq/0/valid/eq: [info] error: unable to access 'bar' in expr_field_unknown_valid_eq_short context [info] ] [info] did not equal [info] [expr_field_unknown_valid_eq_short.ksy: /seq/0/valid: [info] error: unable to access 'bar' in expr_field_unknown_valid_eq_short context [info] ] (SimpleMatchers.scala:34) ``` Changed error message (3, expected must be corrected or false-positives): ``` [info] - attr_bad_valid_any_of *** FAILED *** [info] [attr_bad_valid_any_of.ksy: /seq/0/valid/any-of/0: [info] error: invalid type: expected Int1Type(false), got Int1Type(true) [info] [info] attr_bad_valid_any_of.ksy: /seq/0/valid/any-of/1: [info] error: invalid type: expected Int1Type(false), got Int1Type(true) [info] [info] attr_bad_valid_any_of.ksy: /seq/0/valid/any-of/2: [info] error: invalid type: expected Int1Type(false), got CalcBooleanType [info] [info] attr_bad_valid_any_of.ksy: /seq/0/valid/any-of/3: [info] error: invalid type: expected Int1Type(false), got Int1Type(true) [info] ] [info] did not equal [info] [attr_bad_valid_any_of.ksy: /seq/0/valid/any-of/2: [info] error: can't compare Int1Type(false) and CalcBooleanType [info] ] (SimpleMatchers.scala:34) [info] - attr_bad_valid_range *** FAILED *** [info] [attr_bad_valid_range.ksy: /seq/0/valid/min: [info] error: invalid type: expected Int1Type(false), got CalcBooleanType [info] [info] attr_bad_valid_range.ksy: /seq/0/valid/max: [info] error: invalid type: expected Int1Type(false), got CalcStrType [info] ] [info] did not equal [info] [attr_bad_valid_range.ksy: /seq/0/valid/min: [info] error: can't compare Int1Type(false) and CalcBooleanType [info] [info] attr_bad_valid_range.ksy: /seq/0/valid/max: [info] error: can't compare Int1Type(false) and CalcStrType [info] ] (SimpleMatchers.scala:34) [info] - expr_field_unknown_valid_any_of *** FAILED *** [info] [expr_field_unknown_valid_any_of.ksy: /seq/0/valid/any-of/0: [info] error: invalid type: expected Int1Type(false), got Int1Type(true) [info] [info] expr_field_unknown_valid_any_of.ksy: /seq/0/valid/any-of/1: [info] error: unable to access 'bar' in expr_field_unknown_valid_any_of context [info] [info] expr_field_unknown_valid_any_of.ksy: /seq/0/valid/any-of/2: [info] error: invalid type: expected Int1Type(false), got Int1Type(true) [info] [info] expr_field_unknown_valid_any_of.ksy: /seq/0/valid/any-of/3: [info] error: unable to access 'qux' in expr_field_unknown_valid_any_of context [info] ] [info] did not equal [info] [expr_field_unknown_valid_any_of.ksy: /seq/0/valid/any-of/1: [info] error: unable to access 'bar' in expr_field_unknown_valid_any_of context [info] [info] expr_field_unknown_valid_any_of.ksy: /seq/0/valid/any-of/3: [info] error: unable to access 'qux' in expr_field_unknown_valid_any_of context [info] ] (SimpleMatchers.scala:34) ```
…Equals` and make it abstract Fixed (1): [info] - expr_field_unknown_valid_eq_short *** FAILED *** [info] [expr_field_unknown_valid_eq_short.ksy: /seq/0/valid/eq: [info] error: unable to access 'bar' in expr_field_unknown_valid_eq_short context [info] ] [info] did not equal [info] [expr_field_unknown_valid_eq_short.ksy: /seq/0/valid: [info] error: unable to access 'bar' in expr_field_unknown_valid_eq_short context [info] ] (SimpleMatchers.scala:34)
61d96c3 to
ba95732
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds missing validation for
validkeys. Some problems not solved, because I do not know what is the prefered way for you to solve them. Namely:TypeDetector.assertCompareTypes. Actually the other methods are used which produces another messages. Sometimes this produces false-positives, I guessBelow the changed parts in the output (this is how errors looks after this PR).
Fixed (5):
Changed error message (6, expected must be corrected or false-positives):