[info] - enum_unknown_inst_value *** FAILED ***
[info] [enum_unknown_inst_value.ksy: /instances/should_fail/value:
[info] error: unable to find enum 'animal', searching from enum_unknown_inst_value
[info] ]
[info] did not equal
[info] [enum_unknown_inst_value.ksy: /instances/should_fail/enum:
[info] error: unable to find enum 'animal', searching from enum_unknown_inst_value
[info] ] (SimpleMatchers.scala:34)
(error reported at path .../value instead of the correct path .../enum)
This error is generated by pass SpecsValueTypeDerive which calculates the type of value instance (i. e. expression in the value field). The reason, why enum key influences this pass is because handling of this key implemented as artificial change of the value expression by wrapping it by the Ast.expr.EnumById node.
Then TypeDetector tries to calculate type of this node using ClassTypeProvider.resolveEnum which throws an instance of ExpressionError due to unknown enum. When this exception is caught, it is reported as error in value field.
Possible solution would to not use the Ast.expr.EnumById node, but handle convertion to enum somehow else. Another way is to throw different error when processing Ast.expr.EnumById or somehow else distinguish between throwned errors.
Example of the current error:
(error reported at path
.../value
instead of the correct path.../enum
)This error is generated by pass
SpecsValueTypeDerive
which calculates the type of value instance (i. e. expression in thevalue
field). The reason, whyenum
key influences this pass is because handling of this key implemented as artificial change of thevalue
expression by wrapping it by theAst.expr.EnumById
node.Then
TypeDetector
tries to calculate type of this node usingClassTypeProvider.resolveEnum
which throws an instance ofExpressionError
due to unknown enum. When this exception is caught, it is reported as error invalue
field.Possible solution would to not use the
Ast.expr.EnumById
node, but handle convertion to enum somehow else. Another way is to throw different error when processingAst.expr.EnumById
or somehow else distinguish between throwned errors.