mirror of https://github.com/golang/go.git
[dev.go2go] go/types: permit alias to generic type
Fixes #39768. Change-Id: I68c8fbec5adc50e448dabe90b212ef147a384a06 Reviewed-on: https://go-review.googlesource.com/c/go/+/239387 Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
6ca930a00a
commit
2faeebf4e5
|
|
@ -131,6 +131,7 @@ var tests = [][]string{
|
|||
{"fixedbugs/issue39711.go2"},
|
||||
{"fixedbugs/issue39723.go2"},
|
||||
{"fixedbugs/issue39755.go2"},
|
||||
{"fixedbugs/issue39768.go2"},
|
||||
}
|
||||
|
||||
var fset = token.NewFileSet()
|
||||
|
|
|
|||
|
|
@ -562,7 +562,7 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *ast.TypeSpec, def *Named) {
|
|||
}
|
||||
|
||||
obj.typ = Typ[Invalid]
|
||||
obj.typ = check.typ(tdecl.Type)
|
||||
obj.typ = check.anyType(tdecl.Type)
|
||||
|
||||
} else {
|
||||
// defined type declaration
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
// 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
|
||||
|
||||
type T(type P) P
|
||||
type A = T
|
||||
var x A(int)
|
||||
var _ A /* ERROR cannot use generic type */
|
||||
|
||||
type B = T(int)
|
||||
var y B = x
|
||||
var _ B /* ERROR not a generic type */ (int)
|
||||
|
||||
// test case from issue
|
||||
|
||||
type Vector(type T) []T
|
||||
type VectorAlias = Vector
|
||||
var v Vector(int)
|
||||
Loading…
Reference in New Issue