]> Nishi Git Mirror - gwion.git/commitdiff
:bug: Fix ternary expression
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 13 Apr 2020 21:55:01 +0000 (23:55 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 13 Apr 2020 21:55:01 +0000 (23:55 +0200)
src/parse/check.c

index a15ad008342d8ab9b8c044716b702c763f634676..815bc5bd7ad164bbfb0c76f736fc81572e06ba2a 100644 (file)
@@ -853,6 +853,10 @@ ANN static Type check_exp_if(const Env env, const Exp_If* exp_if) {
     ERR_O(exp_self(exp_if)->pos,
           _("incompatible types '%s' and '%s' in if expression..."),
           if_exp->name, else_exp->name)
+  if(!exp_if->if_exp && isa(exp_if->cond->info->type, else_exp) < 0)
+    ERR_O(exp_self(exp_if)->pos,
+        _("condition type '%s' does not match '%s'"),
+         cond->name, ret->name)
   return ret;
 }