shithub: mc

Download patch

ref: 96cb5ec50175acc33b6f67ae4690e9ef9badaffa
parent: fc6f464b0359791afdd234464482e03714ef4510
author: Ori Bernstein <[email protected]>
date: Tue Jun 18 13:24:41 EDT 2013

Don't turn floats into ints.

    Type inference bug in the post substitution. Oops.

--- a/parse/infer.c
+++ b/parse/infer.c
@@ -309,7 +309,7 @@
         case Lchr:      return mktype(n->line, Tychar);                         break;
         case Lbool:     return mktype(n->line, Tybool);                         break;
         case Lint:      return mktylike(n->line, Tyint);                        break;
-        case Lflt:      return mktylike(n->line, Tyfloat32);                    break;
+        case Lflt:      return mktylike(n->line, Tyfloat64);                    break;
         case Lstr:      return mktyslice(n->line, mktype(n->line, Tybyte));     break;
         case Llbl:      return mktyptr(n->line, mktype(n->line, Tyvoid));       break;
         case Lfunc:     return n->lit.fnval->func.type;                         break;
@@ -1192,7 +1192,7 @@
         if (hascstr(t, cstrtab[Tcint]) && cstrcheck(t, tyint))
             return tyint;
         if (hascstr(t, cstrtab[Tcfloat]) && cstrcheck(t, tyflt))
-            return tyint;
+            return tyflt;
         if (hthas(st->delayed, t))
             return htget(st->delayed, t);
     } else if (!t->fixed) {