Make people write casts...
[IRC.git] / Robust / src / IR / Tree / SemanticCheck.java
index 7dcb5eb1f8b8917f96accd6f86a62e3892c6fdf7..0feb9d0e4deb537647dfb12e6caa219d8d0ff8d7 100644 (file)
@@ -659,6 +659,9 @@ public class SemanticCheck {
        if (bestmd==null)
            throw new Error("No method found for :"+min.printNode(0));
        min.setMethod(bestmd);
+
+       if ((td!=null)&&(min.getType()!=null)&&!typeutil.isSuperorType(td,  min.getType()))
+           throw new Error(min.getType()+ " is not equal to or a subclass of "+td);
        /* Check whether we need to set this parameter to implied this */
        if (!bestmd.isStatic()) {
            if (min.getExpression()==null) {