summaryrefslogtreecommitdiff
path: root/src/cmd/gc/range.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-06-08 18:50:02 -0700
committerRuss Cox <rsc@golang.org>2010-06-08 18:50:02 -0700
commit0b814afd0a2fa1dded3eaf4d2f79b20438842955 (patch)
tree19d1ab733d194831a2bf78d352fc92bb71e86f7a /src/cmd/gc/range.c
parent11704e355aa8f39669a36fe56c01d17deab60658 (diff)
downloadgolang-0b814afd0a2fa1dded3eaf4d2f79b20438842955.tar.gz
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
Diffstat (limited to 'src/cmd/gc/range.c')
-rw-r--r--src/cmd/gc/range.c10
1 files changed, 5 insertions, 5 deletions
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: