diff --git a/src/main/java/de/prob/voparser/VOTypeChecker.java b/src/main/java/de/prob/voparser/VOTypeChecker.java index e296814699f43a2438c0af7ab3675e326e098ee6..3fa6385503434db4f86fe18689a1747e0a9b019b 100644 --- a/src/main/java/de/prob/voparser/VOTypeChecker.java +++ b/src/main/java/de/prob/voparser/VOTypeChecker.java @@ -94,11 +94,10 @@ public class VOTypeChecker extends DepthFirstAdapter { private PersistentHashSet<AnimatorState> visitIdentifierNode(AIdentifierVo node, PersistentHashSet<AnimatorState> animatorState) { final String id = node.getIdentifierLiteral().getText(); if (!voParser.getTasks().containsKey(id)) { - throw new VOTypeCheckException("Scope error in VO"); + throw new VOTypeCheckException("Unknown validation task identifier: " + id); } VTType type = voParser.getTasks().get(id); PersistentHashSet<AnimatorState> newAnimatorState = animatorState; - boolean valid = true; switch (type) { case RELOAD: newAnimatorState = newAnimatorState.cons(AnimatorState.TRACE); @@ -112,23 +111,26 @@ public class VOTypeChecker extends DepthFirstAdapter { newAnimatorState = newAnimatorState.disjoin(AnimatorState.STATE_SPACE); break; case TRACE: - valid = newAnimatorState.contains(AnimatorState.TRACE); + if (!newAnimatorState.contains(AnimatorState.TRACE)) { + throw new VOTypeCheckException("Validation task " + id + " requires a trace"); + } break; case STATE_SPACE: - valid = newAnimatorState.contains(AnimatorState.STATE_SPACE); + if (!newAnimatorState.contains(AnimatorState.STATE_SPACE)) { + throw new VOTypeCheckException("Validation task " + id + " requires a state space"); + } newAnimatorState = newAnimatorState.disjoin(AnimatorState.TRACE); newAnimatorState = newAnimatorState.disjoin(AnimatorState.STATE_SPACE); break; case EXPLORE: - valid = newAnimatorState.contains(AnimatorState.TRACE); + if (!newAnimatorState.contains(AnimatorState.TRACE)) { + throw new VOTypeCheckException("Validation task " + id + " requires a trace"); + } newAnimatorState = newAnimatorState.disjoin(AnimatorState.TRACE); break; default: break; } - if(!valid) { - throw new VOTypeCheckException("Type error in VO"); - } return newAnimatorState; } }