...

Source file src/internal/types/testdata/fixedbugs/issue39768.go

Documentation: internal/types/testdata/fixedbugs

     1  // Copyright 2020 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package p
     6  
     7  // For now, a lone type parameter is not permitted as RHS in a type declaration (issue #45639).
     8  // type T[P any] P
     9  // type A = T  // ERROR "cannot use generic type"
    10  // var x A[int]
    11  // var _ A
    12  //
    13  // type B = T[int]
    14  // var y B = x
    15  // var _ B /* ERROR "not a generic type" */ [int]
    16  
    17  // test case from issue
    18  
    19  type Vector[T any] []T
    20  type VectorAlias = Vector // ERROR "cannot use generic type"
    21  var v Vector[int]
    22  

View as plain text