mirror of
https://github.com/golang/go
synced 2024-11-23 17:30:02 -07:00
cmd/compile: clean up C->Go translation artifacts in badtype
Change-Id: I576a596ed8e9ce14e3750031d0e338e9276eff1e Reviewed-on: https://go-review.googlesource.com/c/go/+/262537 Trust: Alberto Donizetti <alb.donizetti@gmail.com> Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
50b7171af0
commit
3c9488edff
@ -1040,25 +1040,24 @@ func calcHasCall(n *Node) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func badtype(op Op, tl *types.Type, tr *types.Type) {
|
func badtype(op Op, tl, tr *types.Type) {
|
||||||
fmt_ := ""
|
var s string
|
||||||
if tl != nil {
|
if tl != nil {
|
||||||
fmt_ += fmt.Sprintf("\n\t%v", tl)
|
s += fmt.Sprintf("\n\t%v", tl)
|
||||||
}
|
}
|
||||||
if tr != nil {
|
if tr != nil {
|
||||||
fmt_ += fmt.Sprintf("\n\t%v", tr)
|
s += fmt.Sprintf("\n\t%v", tr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// common mistake: *struct and *interface.
|
// common mistake: *struct and *interface.
|
||||||
if tl != nil && tr != nil && tl.IsPtr() && tr.IsPtr() {
|
if tl != nil && tr != nil && tl.IsPtr() && tr.IsPtr() {
|
||||||
if tl.Elem().IsStruct() && tr.Elem().IsInterface() {
|
if tl.Elem().IsStruct() && tr.Elem().IsInterface() {
|
||||||
fmt_ += "\n\t(*struct vs *interface)"
|
s += "\n\t(*struct vs *interface)"
|
||||||
} else if tl.Elem().IsInterface() && tr.Elem().IsStruct() {
|
} else if tl.Elem().IsInterface() && tr.Elem().IsStruct() {
|
||||||
fmt_ += "\n\t(*interface vs *struct)"
|
s += "\n\t(*interface vs *struct)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s := fmt_
|
|
||||||
yyerror("illegal types for operand: %v%s", op, s)
|
yyerror("illegal types for operand: %v%s", op, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user