dupok = obj.DUPOK
}
- if myimportpath == "runtime" && (tbase == types.Types[tbase.Etype] || tbase == types.Bytetype || tbase == types.Runetype || tbase == types.Errortype) { // int, float, etc
- goto ok
- }
-
- // named types from other files are defined only by those files
- if tbase.Sym != nil && !tbase.Local() {
- return s
- }
- if isforw[tbase.Etype] {
- return s
+ if myimportpath != "runtime" || (tbase != types.Types[tbase.Etype] && tbase != types.Bytetype && tbase != types.Runetype && tbase != types.Errortype) { // int, float, etc
+ // named types from other files are defined only by those files
+ if tbase.Sym != nil && !tbase.Local() {
+ return s
+ }
+ // TODO(mdempsky): Investigate whether this can happen.
+ if isforw[tbase.Etype] {
+ return s
+ }
}
-ok:
ot := 0
lsym := s.Linksym()
switch t.Etype {
// and then do one loop.
if t.IsInterface() {
+ Outer:
for _, im := range iface.Fields().Slice() {
for _, tm := range t.Fields().Slice() {
if tm.Sym == im.Sym {
if eqtype(tm.Type, im.Type) {
- goto found
+ continue Outer
}
*m = im
*samename = tm
*samename = nil
*ptr = 0
return false
- found:
}
return true
// the only conversion that isn't a no-op is concrete == interface.
// in that case, check comparability of the concrete type.
// The conversion allocates, so only do it if the concrete type is huge.
+ converted := false
if r.Type.Etype != TBLANK {
aop = assignop(l.Type, r.Type, nil)
if aop != 0 {
}
t = r.Type
- goto converted
+ converted = true
}
}
- if l.Type.Etype != TBLANK {
+ if !converted && l.Type.Etype != TBLANK {
aop = assignop(r.Type, l.Type, nil)
if aop != 0 {
if l.Type.IsInterface() && !r.Type.IsInterface() && !IsComparable(r.Type) {
}
}
- converted:
et = t.Etype
}
// return expr-list
// func(expr-list)
func ascompatte(call *Node, isddd bool, lhs *types.Type, rhs []*Node, fp int, init *Nodes) []*Node {
- var nn []*Node
-
// f(g()) where g has multiple return values
if len(rhs) == 1 && rhs[0].Type.IsFuncArgStruct() {
// optimization - can do block copy
nl := nodarg(lhs, fp)
nr := nod(OCONVNOP, rhs[0], nil)
nr.Type = nl.Type
- nn = []*Node{convas(nod(OAS, nl, nr), init)}
- goto ret
+ n := convas(nod(OAS, nl, nr), init)
+ n.SetTypecheck(1)
+ return []*Node{n}
}
// conversions involved.
// If there's a ... parameter (which is only valid as the final
// parameter) and this is not a ... call expression,
// then assign the remaining arguments as a slice.
+ var nn []*Node
for i, nl := range lhs.FieldSlice() {
var nr *Node
if nl.Isddd() && !isddd {
a := nod(OAS, nodarg(nl, fp), nr)
a = convas(a, init)
+ a.SetTypecheck(1)
nn = append(nn, a)
}
-ret:
- for _, n := range nn {
- n.SetTypecheck(1)
- }
return nn
}