Black Lives Matter. Support the Equal Justice Initiative.

Text file src/go/parser/testdata/typeparams.src

Documentation: go/parser/testdata

     1  // Copyright 2021 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  // Test cases for error messages produced while parsing code that uses type
     6  // parameters, without ParseTypeParams being enabled.
     7  
     8  package p
     9  
    10  type List[E any /* ERROR "expected ']', found any" */ ] []E
    11  
    12  type Pair[L, /* ERROR "expected ']', found ','" */ R any] struct {
    13  	Left L
    14  	Right R
    15  }
    16  
    17  var _ = Pair[int, /* ERROR "expected ']' or ':', found ','" */ string]{}
    18  

View as plain text