mirror of
https://github.com/golang/go
synced 2024-10-03 03:01:21 -06:00
cmd/gc: implement revised rule for shifts in equality.
R=rsc, daniel.morsing CC=golang-dev https://golang.org/cl/7613046
This commit is contained in:
parent
1b6b1bc66e
commit
465ff4cfc0
@ -1211,6 +1211,7 @@ void
|
|||||||
defaultlit2(Node **lp, Node **rp, int force)
|
defaultlit2(Node **lp, Node **rp, int force)
|
||||||
{
|
{
|
||||||
Node *l, *r;
|
Node *l, *r;
|
||||||
|
int lkind, rkind;
|
||||||
|
|
||||||
l = *lp;
|
l = *lp;
|
||||||
r = *rp;
|
r = *rp;
|
||||||
@ -1230,18 +1231,20 @@ defaultlit2(Node **lp, Node **rp, int force)
|
|||||||
convlit(lp, types[TBOOL]);
|
convlit(lp, types[TBOOL]);
|
||||||
convlit(rp, types[TBOOL]);
|
convlit(rp, types[TBOOL]);
|
||||||
}
|
}
|
||||||
if(isconst(l, CTCPLX) || isconst(r, CTCPLX)) {
|
lkind = idealkind(l);
|
||||||
|
rkind = idealkind(r);
|
||||||
|
if(lkind == CTCPLX || rkind == CTCPLX) {
|
||||||
convlit(lp, types[TCOMPLEX128]);
|
convlit(lp, types[TCOMPLEX128]);
|
||||||
convlit(rp, types[TCOMPLEX128]);
|
convlit(rp, types[TCOMPLEX128]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(isconst(l, CTFLT) || isconst(r, CTFLT)) {
|
if(lkind == CTFLT || rkind == CTFLT) {
|
||||||
convlit(lp, types[TFLOAT64]);
|
convlit(lp, types[TFLOAT64]);
|
||||||
convlit(rp, types[TFLOAT64]);
|
convlit(rp, types[TFLOAT64]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isconst(l, CTRUNE) || isconst(r, CTRUNE)) {
|
if(lkind == CTRUNE || rkind == CTRUNE) {
|
||||||
convlit(lp, runetype);
|
convlit(lp, runetype);
|
||||||
convlit(rp, runetype);
|
convlit(rp, runetype);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user