Skip to content

Commit

Permalink
Fix error propagation for ! and BoolExp
Browse files Browse the repository at this point in the history
If !x is an error, don't change it to a boolean.
  • Loading branch information
don-clugston-sociomantic committed Mar 26, 2013
1 parent 0442749 commit b9c45f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/expression.c
Expand Up @@ -8917,6 +8917,8 @@ Expression *NotExp::semantic(Scope *sc)
UnaExp::semantic(sc);
e1 = resolveProperties(sc, e1);
e1 = e1->checkToBoolean(sc);
if (e1->type == Type::terror)
return e1;
type = Type::tboolean;
}
return this;
Expand Down Expand Up @@ -8944,6 +8946,8 @@ Expression *BoolExp::semantic(Scope *sc)
UnaExp::semantic(sc);
e1 = resolveProperties(sc, e1);
e1 = e1->checkToBoolean(sc);
if (e1->type == Type::terror)
return e1;
type = Type::tboolean;
}
return this;
Expand Down
9 changes: 5 additions & 4 deletions test/fail_compilation/test8556.d
@@ -1,10 +1,11 @@
/*
TEST_OUTPUT:
---
fail_compilation/test8556.d(44): Error: template test8556.grabExactly matches more than one template declaration, fail_compilation/test8556.d(30):grabExactly(R)(R range) if (!isSliceable!(R)) and fail_compilation/test8556.d(31):grabExactly(R)(R range) if (isSliceable!(R))
fail_compilation/test8556.d(19): Error: template instance test8556.isSliceable!(Circle!(uint[])) error instantiating
fail_compilation/test8556.d(24): Error: Grab!(Circle!(uint[])) is used as a type
fail_compilation/test8556.d(55): Error: template instance test8556.grab!(Circle!(uint[])) error instantiating
fail_compilation/test8556.d(45): Error: template test8556.grabExactly matches more than one template declaration, fail_compilation/test8556.d(31):grabExactly(R)(R range) if (!isSliceable!(R)) and fail_compilation/test8556.d(32):grabExactly(R)(R range) if (isSliceable!(R))
fail_compilation/test8556.d(20): Error: template instance test8556.isSliceable!(Circle!(uint[])) error instantiating
fail_compilation/test8556.d(25): Error: template instance Grab!(Circle!(uint[])) Grab!(Circle!(uint[])) does not match template declaration Grab(Range) if (!isSliceable!(Range))
fail_compilation/test8556.d(25): Error: Grab!(Circle!(uint[])) is used as a type
fail_compilation/test8556.d(56): Error: template instance test8556.grab!(Circle!(uint[])) error instantiating
---
*/

Expand Down

0 comments on commit b9c45f3

Please sign in to comment.