-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
Extracted from #39758: The following program
package main
type top(type T, T2) struct {
p *parent(T, T2)
}
type parent(type T, T2) struct {
(child(T, T2))
}
type child(type T, T2) struct {
T2
}
func (d *top(T, T2)) foo() *T {
// panic: internal error: receiver type parameter inference failed
// t, _ := d.p.foo()
// panic: -: unexpected type string character '₇' in "T₇"
t, _ := d.p.child.foo()
return t
}
func (rb *child(T, T2)) foo() (*T, bool) {
return nil, true
}
func main() {
var _ top(int, int)
}
type-checks ok but the translator reports
$ go tool go2go run main.go2
panic: unexpected type parameter
goroutine 1 [running]:
go/go2go.(*translator).typeToAST(0xc0001a5678, 0x12e40a0, 0xc00012ae80, 0xc00011d6e0, 0xc0001a4c78)
/Users/gri/go/src/go/go2go/types.go:596 +0x1725
go/go2go.(*translator).typeListToASTList(0xc0001a5678, 0xc00011cf80, 0x2, 0x2, 0x0, 0x0, 0xc0001241f8, 0xc0001a4b68, 0x1003598, 0x12570c0)
/Users/gri/go/src/go/go2go/rewrite.go:1175 +0xe5
go/go2go.(*translator).lookupInstantiatedType(0xc0001a5678, 0xc0001366c0, 0x0, 0x0, 0x0)
/Users/gri/go/src/go/go2go/rewrite.go:1095 +0x2b6
go/go2go.(*translator).translateSelectorExpr(0xc0001a5678, 0xc00011c780)
/Users/gri/go/src/go/go2go/rewrite.go:804 +0x5b1
go/go2go.(*translator).translateExpr(0xc0001a5678, 0xc00011c780)
/Users/gri/go/src/go/go2go/rewrite.go:666 +0x4ba
go/go2go.(*translator).translateSelectorExpr(0xc0001a5678, 0xc00012a800)
/Users/gri/go/src/go/go2go/rewrite.go:756 +0x71
go/go2go.(*translator).translateExpr(0xc0001a5678, 0xc00012a800)
/Users/gri/go/src/go/go2go/rewrite.go:666 +0x4ba
go/go2go.(*translator).translateExpr(0xc0001a5678, 0xc0001046c0)
/Users/gri/go/src/go/go2go/rewrite.go:685 +0x385
go/go2go.(*translator).translateExprList(0xc0001a5678, 0xc0001046c0, 0x1, 0x1)
/Users/gri/go/src/go/go2go/rewrite.go:852 +0x46
go/go2go.(*translator).translateStmt(0xc0001a5678, 0xc00011c7e0)
/Users/gri/go/src/go/go2go/rewrite.go:583 +0x29d
go/go2go.(*translator).translateBlockStmt(0xc0001a5678, 0xc000106de0)
/Users/gri/go/src/go/go2go/rewrite.go:544 +0x57
go/go2go.(*translator).translateFuncDecl(0xc0001a5678, 0xc00011d5b0)
/Users/gri/go/src/go/go2go/rewrite.go:534 +0xc5
go/go2go.(*translator).translate(0xc0001a5678, 0xc000140280)
/Users/gri/go/src/go/go2go/rewrite.go:461 +0x391
go/go2go.rewriteAST(0xc00012a240, 0xc000126360, 0x0, 0x0, 0xc000101770, 0xc000140280, 0x2583701, 0xc00012a5c0, 0x14197e0)
/Users/gri/go/src/go/go2go/rewrite.go:257 +0xe5
go/go2go.rewriteFile(0xc00017a0a0, 0x43, 0xc00012a240, 0xc000126360, 0x0, 0x0, 0xc000101770, 0xc00017a230, 0x4c, 0xc000140280, ...)
/Users/gri/go/src/go/go2go/rewrite.go:221 +0xb8
go/go2go.rewriteFilesInPath(0xc000126360, 0x0, 0x0, 0xc00017a0a0, 0x43, 0xc000104480, 0x1, 0x1, 0x0, 0x0, ...)
/Users/gri/go/src/go/go2go/go2go.go:114 +0xc5c
go/go2go.rewriteToPkgs(0xc000126360, 0x0, 0x0, 0xc00017a0a0, 0x43, 0xc0001061a0, 0xc00017a0a0, 0x43, 0x7ffeefbffa96, 0x8)
/Users/gri/go/src/go/go2go/go2go.go:46 +0x165
go/go2go.Rewrite(...)
/Users/gri/go/src/go/go2go/go2go.go:30
main.translate(0xc000126360, 0xc00017a0a0, 0x43)
/Users/gri/go/src/cmd/go2go/translate.go:15 +0x47
main.main()
/Users/gri/go/src/cmd/go2go/main.go:54 +0xb25
codenoid
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.