ref: 24e5832913b266731b7b0cbe430587ee6e76f683
parent: e249c8a903e8a01bf59550aeb95a55ba216256b6
author: Ori Bernstein <[email protected]>
date: Mon Oct 21 12:34:05 EDT 2013
Revert "Better error messages" This reverts commit 3543d66fb1a4bb9ca794a8031fa86579df1f4fb0.
--- a/6/simp.c
+++ b/6/simp.c
@@ -1012,7 +1012,7 @@
}
}
if (!uc)
- die("Couldn't find union constructor %s in %s", namestr(n->expr.args[0]), tystr(ty));
+ die("Couldn't find union constructor");
if (dst)
tmp = dst;
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -238,7 +238,6 @@
pkgitem : decl
{putdcl(file->file.exports, $1);
- $1->decl.isglobl = 1;
if ($1->decl.init)
lappend(&file->file.stmts, &file->file.nstmts, $1);}
| tydef {puttype(file->file.exports, mkname($1.line, $1.name), $1.type);
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -623,10 +623,6 @@
if (occurs(a, b))
fatal(ctx->line, "Infinite type %s in %s near %s",
tystr(a), tystr(b), ctxstr(st, ctx));
- if (a->type == Tyname && b->type == Tyname)
- if (!nameeq(a->name, b->name))
- fatal(ctx->line, "%s incompatible with %s near %s",
- tystr(a), tystr(b), ctxstr(st, ctx));
/* if the tyrank of a is 0 (ie, a raw tyvar), just unify.
* Otherwise, match up subtypes. */
@@ -640,6 +636,9 @@
} else if (hasparam(a) && hasparam(b)) {
/* Only Tygeneric and Tyname should be able to unify. And they
* should have the same names for this to be true. */
+ if (!nameeq(a->name, b->name))
+ fatal(ctx->line, "%s incompatible with %s near %s",
+ tystr(a), tystr(b), ctxstr(st, ctx));
if (a->narg != b->narg)
fatal(ctx->line, "%s has wrong parameter list for %s near %s",
tystr(a), tystr(b), ctxstr(st, ctx));
@@ -1272,6 +1271,8 @@
break;
case Nmatchstmt:
infernode(st, n->matchstmt.val, NULL, sawret);
+ if (tybase(type(st, n->matchstmt.val))->type == Tyvoid)
+ fatal(n->line, "Can't match against a void type near %s", ctxstr(st, n->matchstmt.val));
for (i = 0; i < n->matchstmt.nmatches; i++) {
infernode(st, n->matchstmt.matches[i], ret, sawret);
unify(st, n, type(st, n->matchstmt.val), type(st, n->matchstmt.matches[i]->match.pat));
@@ -1321,7 +1322,7 @@
tyflt = mktype(-1, Tyfloat64);
t = tysearch(st, t);
- if (t->type == Tyvar && hthas(st->delayed, t))
+ if (hthas(st->delayed, t))
t = htget(st->delayed, t);
if (t->type == Tyvar) {
if (hascstr(t, cstrtab[Tcint]) && cstrcheck(t, tyint))
@@ -1523,8 +1524,6 @@
break;
case Nmatchstmt:
typesub(st, n->matchstmt.val);
- if (tybase(type(st, n->matchstmt.val))->type == Tyvoid)
- fatal(n->line, "Can't match against a void type near %s", ctxstr(st, n->matchstmt.val));
for (i = 0; i < n->matchstmt.nmatches; i++) {
typesub(st, n->matchstmt.matches[i]);
}
--- a/parse/parse.h
+++ b/parse/parse.h
@@ -242,7 +242,6 @@
char isconst;
char isgeneric;
char isextern;
- Vis vis;
Node *name;
Type *type;
Node *init;
--- a/parse/use.c
+++ b/parse/use.c
@@ -800,8 +800,6 @@
nodetag(n->lit.fnval);
break;
case Ndecl:
- if (n->decl.vis == Visintern && n->decl.isglobl)
- n->decl.vis = Vishidden;
taghidden(n->decl.type);
/* generics export their body. */
if (n->decl.isgeneric)
@@ -847,7 +845,6 @@
k = htkeys(st->dcl, &n);
for (i = 0; i < n; i++) {
s = getdcl(st, k[i]);
- s->decl.vis = Visexport;
nodetag(s);
}
}
@@ -862,19 +859,19 @@
*/
void writeuse(FILE *f, Node *file)
{
- Stab *ex;//, *st;
- //void **k;
+ Stab *st;
+ void **k;
Node *s;
- size_t i; //, n;
+ size_t i, n;
- ex = file->file.exports;
+ st = file->file.exports;
wrbyte(f, 'U');
- if (ex->name)
- wrstr(f, namestr(ex->name));
+ if (st->name)
+ wrstr(f, namestr(st->name));
else
wrstr(f, NULL);
- tagexports(ex);
+ tagexports(st);
for (i = 0; i < ntypes; i++) {
if (types[i]->vis == Visexport || types[i]->vis == Vishidden) {
wrbyte(f, 'T');
@@ -882,8 +879,6 @@
typickle(f, types[i]);
}
}
- /*
- st = file->file.globls;
k = htkeys(st->dcl, &n);
for (i = 0; i < n; i++) {
s = getdcl(st, k[i]);
@@ -894,15 +889,4 @@
wrsym(f, s);
}
free(k);
- */
- for (i = 0; i < ndecls; i++) {
- s = decls[i];
- if (s->decl.vis == Visintern)
- continue;
- if (s->decl.isgeneric)
- wrbyte(f, 'G');
- else
- wrbyte(f, 'D');
- wrsym(f, s);
- }
}