From 0b814afd0a2fa1dded3eaf4d2f79b20438842955 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 8 Jun 2010 18:50:02 -0700 Subject: gc: new typechecking rules * Code for assignment, conversions now mirrors spec. * Changed some snprint -> smprint. * Renamed runtime functions to separate interface conversions from type assertions: convT2I, assertI2T, etc. * Correct checking of \U sequences. Fixes issue 840. Fixes issue 830. Fixes issue 778. R=ken2 CC=golang-dev http://codereview.appspot.com/1303042 --- src/cmd/gc/range.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/cmd/gc/range.c') diff --git a/src/cmd/gc/range.c b/src/cmd/gc/range.c index 2794504d2..09d54b3ee 100644 --- a/src/cmd/gc/range.c +++ b/src/cmd/gc/range.c @@ -11,7 +11,7 @@ void typecheckrange(Node *n) { - int op, et; + char *why; Type *t, *t1, *t2; Node *v1, *v2; NodeList *ll; @@ -66,13 +66,13 @@ typecheckrange(Node *n) if(v1->defn == n) v1->type = t1; - else if(v1->type != T && checkconv(t1, v1->type, 0, &op, &et, "range") < 0) - yyerror("cannot assign type %T to %+N", t1, v1); + else if(v1->type != T && assignop(t1, v1->type, &why) == 0) + yyerror("cannot assign type %T to %+N in range%s", t1, v1, why); if(v2) { if(v2->defn == n) v2->type = t2; - else if(v2->type != T && checkconv(t2, v2->type, 0, &op, &et, "range") < 0) - yyerror("cannot assign type %T to %+N", t1, v1); + else if(v2->type != T && assignop(t2, v2->type, &why) == 0) + yyerror("cannot assign type %T to %+N in range%s", t2, v2, why); } out: -- cgit v1.2.3