@ -371,12 +371,19 @@ public class TypeCheck extends ASTTraverse
}
}
break ;
break ;
case ExpressionFunc . MULTI :
case ExpressionFunc . MULTI :
/ / All operands must be booleans or doubles
/ / All operands must be booleans or doubles , and doubles must come first .
boolean seenBoolean = false ;
for ( i = 0 ; i < n ; i + + ) {
for ( i = 0 ; i < n ; i + + ) {
if ( ! ( types [ i ] instanceof TypeBool | | types [ i ] instanceof TypeDouble ) ) {
if ( ! ( types [ i ] instanceof TypeBool | | types [ i ] instanceof TypeDouble ) ) {
throw new PrismLangException ( "Type error: non-Boolean/Double argument to function \"" + e . getName ( )
throw new PrismLangException ( "Type error: non-Boolean/Double argument to function \"" + e . getName ( )
+ "\"" , e . getOperand ( i ) ) ;
+ "\"" , e . getOperand ( i ) ) ;
}
}
if ( seenBoolean & & types [ i ] instanceof TypeDouble ) {
throw new PrismLangException ( "Type error: in the function \"" + e . getName ( ) + "\", any Double arguments must come before any Boolean arguments." ) ;
}
if ( types [ i ] instanceof TypeBool ) {
seenBoolean = true ;
}
}
}
break ;
break ;
default :
default :