Skip to content

Commit

Permalink
[dev.go2go] go/go2go: error, not panic, for local parameterized type
Browse files Browse the repository at this point in the history
Fixes #39643

Change-Id: I45aaaf8818d4d383d1514891b5cc9bc68926ad97
Reviewed-on: https://go-review.googlesource.com/c/go/+/238619
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
ianlancetaylor committed Jun 17, 2020
1 parent e0d5d9f commit 143b944
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/go/go2go/rewrite.go
Expand Up @@ -416,7 +416,8 @@ func (t *translator) translate(file *ast.File) {
func (t *translator) translateTypeSpec(ps *ast.Spec) {
ts := (*ps).(*ast.TypeSpec)
if ts.TParams != nil {
panic("parameterized type")
t.err = fmt.Errorf("%s: go2go tool does not support parameterized type here", t.fset.Position((*ps).Pos()))
return
}
t.translateExpr(&ts.Type)
}
Expand Down
11 changes: 11 additions & 0 deletions test/gen/err004.go2
@@ -0,0 +1,11 @@
// errorcheck

// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package p

func F() {
type t(type T) T // ERROR "parameterized type"
}

0 comments on commit 143b944

Please sign in to comment.