diff options
author | stefanheule <unknown> | 2012-09-24 15:19:21 +0200 |
---|---|---|
committer | stefanheule <unknown> | 2012-09-24 15:19:21 +0200 |
commit | 26d12da2672f68b1600b0082f526cd3423ddd05a (patch) | |
tree | 7bde229572066c7e59dda4007de4de6f983c4c6e | |
parent | 9490abe2e0cab333b2294cd8d81475ae7c486538 (diff) |
Chalice: Fix type-checker incompleteness.
-rw-r--r-- | Chalice/src/main/scala/Resolver.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Chalice/src/main/scala/Resolver.scala b/Chalice/src/main/scala/Resolver.scala index 95ae5f9e..3acd2499 100644 --- a/Chalice/src/main/scala/Resolver.scala +++ b/Chalice/src/main/scala/Resolver.scala @@ -1042,7 +1042,7 @@ object Resolver { case ite@IfThenElse(con, then, els) =>
ResolveExpr(con, context, twoStateContext, false); ResolveExpr(then, context, twoStateContext, specContext); ResolveExpr(els, context, twoStateContext, specContext);
if (!con.typ.IsBool) context.Error(con.pos, "condition of if-then-else expression must be a boolean");
- if (! canAssign(then.typ, els.typ)) context.Error(ite.pos, "the then and else branch of an if-then-else expression must have compatible types");
+ if (!canAssign(then.typ, els.typ) && !canAssign(els.typ, then.typ)) context.Error(ite.pos, "the then and else branch of an if-then-else expression must have compatible types");
ite.typ = then.typ;
case expr@ Not(e) =>
ResolveExpr(e, context, twoStateContext, false)
|