summaryrefslogtreecommitdiff
path: root/parse/infer.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse/infer.c')
-rw-r--r--parse/infer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/parse/infer.c b/parse/infer.c
index 7a5058c..cdcc71a 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1317,13 +1317,12 @@ static void inferexpr(Inferstate *st, Node *n, Type *ret, int *sawret)
t = unify(st, n, t, type(st, args[i]));
settype(st, n, t);
if (args[0]->expr.isconst)
- fatal(n, "Attempting to assign constant \"%s\"", ctxstr(st, args[0]));
+ fatal(n, "attempting to assign constant \"%s\"", ctxstr(st, args[0]));
break;
/* operands same type, returning bool */
case Olor: /* @a || @b -> bool */
case Oland: /* @a && @b -> bool */
- case Olnot: /* !@a -> bool */
case Oeq: /* @a == @a -> bool */
case One: /* @a != @a -> bool */
case Ogt: /* @a > @a -> bool */
@@ -1337,6 +1336,12 @@ static void inferexpr(Inferstate *st, Node *n, Type *ret, int *sawret)
settype(st, n, mktype(Zloc, Tybool));
break;
+ case Olnot: /* !bool -> bool */
+ infersub(st, n, ret, sawret, &isconst);
+ t = unify(st, n, type(st, args[0]), mktype(Zloc, Tybool));
+ settype(st, n, t);
+ break;
+
/* reach into a type and pull out subtypes */
case Oaddr: /* &@a -> @a* */
infersub(st, n, ret, sawret, &isconst);
@@ -2242,3 +2247,4 @@ void infer(Node *file)
typesub(&st, file);
specialize(&st, file);
}
+