1
0
mirror of https://github.com/golang/go synced 2024-09-30 02:24:43 -06:00

cmd/gc: remove mentions of "ideal" from error messages.

_ = complex("foo", 0)
        _ = complex(true, 0)
now trigger:
        x.go:4: invalid operation: complex("foo", 0) (mismatched types untyped string and untyped number)
        x.go:5: invalid operation: complex(true, 0) (mismatched types untyped bool and untyped number)

Fixes #4521

R=golang-dev, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/12973043
This commit is contained in:
Rob Pike 2013-08-16 12:40:02 +10:00
parent 3495aa298d
commit 703b897f78
3 changed files with 4 additions and 4 deletions

View File

@ -1056,7 +1056,7 @@ nodcplxlit(Val r, Val i)
}
// idealkind returns a constant kind like consttype
// but for an arbitrary "ideal" expression.
// but for an arbitrary "ideal" (untyped constant) expression.
static int
idealkind(Node *n)
{

View File

@ -577,7 +577,7 @@ basicnames[] =
[TANY] = "any",
[TSTRING] = "string",
[TNIL] = "nil",
[TIDEAL] = "ideal",
[TIDEAL] = "untyped number",
[TBLANK] = "blank",
};
@ -619,7 +619,7 @@ typefmt(Fmt *fp, Type *t)
if(t->etype < nelem(basicnames) && basicnames[t->etype] != nil) {
if(fmtmode == FErr && (t == idealbool || t == idealstring))
fmtstrcpy(fp, "ideal ");
fmtstrcpy(fp, "untyped ");
return fmtstrcpy(fp, basicnames[t->etype]);
}

View File

@ -90,7 +90,7 @@ static char* _typekind[] = {
[TARRAY] = "array",
[TFUNC] = "func",
[TNIL] = "nil",
[TIDEAL] = "ideal number",
[TIDEAL] = "untyped number",
};
static char*