Commit 29a2aa87 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

bugfix YELLOW

refs 934
parent 8381549a
......@@ -67,7 +67,7 @@ import org.fortiss.af3.project.typesystem.ITypeChecker;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating GREEN Hash: 476B43BAE64CD3A4CFCE10B128CD65A9
* @ConQAT.Rating YELLOW Hash: 7BA238DAECF4630D6D695458F7FD43F3
*/
public class TypeChecker implements ITypeChecker {
......@@ -229,7 +229,7 @@ public class TypeChecker implements ITypeChecker {
case MULTIPLY:
case DIVIDE:
case MODULO:
return typecheckArithmetic(call, operator, context);
return typecheckArithmetic(call, expected, operator, context);
case GREATER_EQUAL:
case GREATER_THAN:
case LOWER_EQUAL:
......@@ -321,7 +321,8 @@ public class TypeChecker implements ITypeChecker {
}
/** Type-checks arithmetic {@link FunctionCall}s. */
private boolean typecheckArithmetic(FunctionCall call, EOperator operator, EObject context) {
private boolean typecheckArithmetic(FunctionCall call, IType expected, EOperator operator,
EObject context) {
ITerm left = call.getArguments(0);
ITerm right = call.getArguments(1);
switch(operator) {
......@@ -330,8 +331,13 @@ public class TypeChecker implements ITypeChecker {
case MULTIPLY:
case DIVIDE:
case MODULO:
return typecheckIntOperands(left, right, context) ||
typecheckDoubleOperands(left, right, context);
if(expected instanceof TInt) {
return typecheckIntOperands(left, right, context);
}
if(expected instanceof TDouble) {
return typecheckDoubleOperands(left, right, context);
}
return false;
default:
return raiseUnsupportedITermInTypeCheckException(call);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment