- \r
- public Expression checkBasicType(TypingContext context, Type requiredType) {\r
- return context.subsume(inferType(context), requiredType);\r
- }\r
+\r
+ public Expression checkBasicType(TypingContext context, Type requiredType) {\r
+ return context.subsume(inferType(context), requiredType);\r
+ }\r
+ \r
+ protected Expression applyPUnit(EnvironmentalContext context) {\r
+ Type type = Types.canonical(getType());\r
+ if(type instanceof TFun) {\r
+ TFun fun = (TFun)type;\r
+ if(fun.getCanonicalDomain() == Types.PUNIT) {\r
+ EApply result = new EApply(location, this, new ELiteral(NoRepConstant.PUNIT));\r
+ result.effect = fun.getCanonicalEffect();\r
+ return result;\r
+ }\r
+ }\r
+ return this;\r
+ }\r
+\r
+ public Expression checkIgnoredType(TypingContext context) {\r
+ Expression expression = inferType(context);\r
+ if(Types.canonical(expression.getType()) != Types.UNIT)\r
+ expression = new ESimpleLet(location, null, expression, new ELiteral(NoRepConstant.PUNIT));\r
+ return expression;\r
+ }\r