Debian Codegraph @

test/fixedbugs/notinheap.go

raw
1 // errorcheck -+
2
3 // Copyright 2016 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 // Test type-checking errors for not-in-heap types.
8
9 //go:build cgo
10
11 package p
12
13 import "runtime/cgo"
14
15 type nih struct{ _ cgo.Incomplete }
16
17 type embed4 map[nih]int // ERROR "incomplete \(or unallocatable\) map key not allowed"
18
19 type embed5 map[int]nih // ERROR "incomplete \(or unallocatable\) map value not allowed"
20
21 type emebd6 chan nih // ERROR "chan of incomplete \(or unallocatable\) type not allowed"
22
23 type okay1 *nih
24
25 type okay2 []nih
26
27 type okay3 func(x nih) nih
28
29 type okay4 interface {
30 f(x nih) nih
31 }
32
33 func f() {
34 type embed7 map[nih]int // ERROR "incomplete \(or unallocatable\) map key not allowed"
35 type embed8 map[int]nih // ERROR "incomplete \(or unallocatable\) map value not allowed"
36 type emebd9 chan nih // ERROR "chan of incomplete \(or unallocatable\) type not allowed"
37 }