Debian Codegraph @

test/typeparam/aliasimp.dir/main.go

raw
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 main
6
7 import "./a"
8
9 type R[T any] struct {
10 F T
11 }
12
13 // type S = R // disallowed for now
14
15 type Sint = R[int]
16
17 // type Simp = a.Rimp // disallowed for now
18
19 // type SimpString Simp[string] // disallowed for now
20 type SimpString a.Rimp[string]
21
22 func main() {
23 // var s S[int] // disallowed for now
24 var s R[int]
25 if s.F != 0 {
26 panic(s.F)
27 }
28 var s2 Sint
29 if s2.F != 0 {
30 panic(s2.F)
31 }
32 // var s3 Simp[string] // disallowed for now
33 var s3 a.Rimp[string]
34 if s3.F != "" {
35 panic(s3.F)
36 }
37 var s4 SimpString
38 if s4.F != "" {
39 panic(s4.F)
40 }
41 }