]> Cypherpunks repositories - gostls13.git/commitdiff
gc: Switch related errors should use plain format.
authorLuuk van Dijk <lvd@golang.org>
Sun, 6 Nov 2011 21:13:54 +0000 (22:13 +0100)
committerLuuk van Dijk <lvd@golang.org>
Sun, 6 Nov 2011 21:13:54 +0000 (22:13 +0100)
Fixes #2422.

R=rsc
CC=golang-dev
https://golang.org/cl/5353046

src/cmd/gc/swt.c
test/fixedbugs/bug340.go

index 0381132d03a0767f267d0e9a01e8587263ad32c3..97874e264ad88762cbee50d9f83a07ba6ad93678 100644 (file)
@@ -825,7 +825,7 @@ typecheckswitch(Node *n)
                typecheck(&n->ntest->right, Erv);
                t = n->ntest->right->type;
                if(t != T && t->etype != TINTER)
-                       yyerror("cannot type switch on non-interface value %+N", n->ntest->right);
+                       yyerror("cannot type switch on non-interface value %lN", n->ntest->right);
        } else {
                // value switch
                top = Erv;
@@ -860,13 +860,13 @@ typecheckswitch(Node *n)
                                        if(ll->n->op == OTYPE)
                                                yyerror("type %T is not an expression", ll->n->type);
                                        else if(ll->n->type != T && !eqtype(ll->n->type, t))
-                                               yyerror("case %+N in %T switch", ll->n, t);
+                                               yyerror("case %lN in %T switch", ll->n, t);
                                        break;
                                case Etype:     // type switch
                                        if(ll->n->op == OLITERAL && istype(ll->n->type, TNIL)) {
                                                ;
                                        } else if(ll->n->op != OTYPE && ll->n->type != T) {
-                                               yyerror("%#N is not a type", ll->n);
+                                               yyerror("%lN is not a type", ll->n);
                                                // reset to original type
                                                ll->n = n->ntest->right;
                                        }
index 2241090d696717665cfc70e6e14cfa42eb81bcd5..37731aad67628e42090bae0f6d4efcaa21adc796 100644 (file)
@@ -10,7 +10,7 @@ package main
 
 func main() {
        var x interface{}
-       switch t := x.(type) { // GC_ERROR "is not a type"
+       switch t := x.(type) { // GC_ERROR "is not a type"
        case 0:         // GCCGO_ERROR "expected type"
                t.x = 1 // ERROR "type interface \{\}|reference to undefined field or method"
        }