• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5package p
6
7type (
8        // these need a comma to disambiguate
9        _[P *T,] struct{}
10        _[P *T, _ any] struct{}
11        _[P (*T),] struct{}
12        _[P (*T), _ any] struct{}
13        _[P (T),] struct{}
14        _[P (T), _ any] struct{}
15
16        // these parse as name followed by type
17        _[P *struct{}] struct{}
18        _[P (*struct{})] struct{}
19        _[P ([]int)] struct{}
20
21        // array declarations
22        _ [P(T)]struct{}
23        _ [P((T))]struct{}
24        _ [P * *T] struct{} // this could be a name followed by a type but it makes the rules more complicated
25        _ [P * T]struct{}
26        _ [P(*T)]struct{}
27        _ [P(**T)]struct{}
28        _ [P * T - T]struct{}
29        _ [P*T-T /* ERROR unexpected comma */ ,]struct{}
30        _ [10 /* ERROR unexpected comma */ ,]struct{}
31)
32