Skip to content

Commit

Permalink
improved error message when expected type cannot be calculated
Browse files Browse the repository at this point in the history
fixes #779
  • Loading branch information
peq committed Dec 22, 2018
1 parent 11662b9 commit 8383632
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Expand Up @@ -3,6 +3,7 @@
import de.peeeq.wurstscript.WLogger;
import de.peeeq.wurstscript.ast.*;
import de.peeeq.wurstscript.types.*;
import de.peeeq.wurstscript.utils.Utils;

import java.util.Collection;

Expand Down Expand Up @@ -90,12 +91,12 @@ public static WurstType calculate(Expr expr) {
return m.attrFunctionSignature().getReceiverType();
}
}
} catch (
CompileError t)

{
} catch (CyclicDependencyError | CompileError t) {
WLogger.info("Something went wrong while computing the expected type for " + Utils.printElementWithSource(expr) + "\n" +
"This is probably not a bug, but we are logging it anyway since it might help to improve error messages.");
WLogger.info(t);
}

return WurstTypeUnknown.instance();
}

Expand Down
Expand Up @@ -554,7 +554,7 @@ public static WurstType calculate(ExprMemberMethodDotDot e) {

public static WurstType calculate(ExprEmpty e) {
e.addError("Missing expression");
return new WurstTypeUnknown("empty expression");
return new WurstTypeUnknown("empty");
}

public static WurstType calculate(ExprIfElse e) {
Expand Down

0 comments on commit 8383632

Please sign in to comment.