summaryrefslogtreecommitdiff
path: root/test/map1.go
blob: 369e49da5d0bf4d1683f26f344f8a81435681928 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// errorcheck

// Copyright 2011 The Go Authors.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Test map declarations of many types, including erroneous ones.
// Does not compile.

package main

func main() {}

type v bool

var (
	// valid
	_ map[int8]v
	_ map[uint8]v
	_ map[int16]v
	_ map[uint16]v
	_ map[int32]v
	_ map[uint32]v
	_ map[int64]v
	_ map[uint64]v
	_ map[int]v
	_ map[uint]v
	_ map[uintptr]v
	_ map[float32]v
	_ map[float64]v
	_ map[complex64]v
	_ map[complex128]v
	_ map[bool]v
	_ map[string]v
	_ map[chan int]v
	_ map[*int]v
	_ map[struct{}]v
	_ map[[10]int]v

	// invalid
	_ map[[]int]v       // ERROR "invalid map key"
	_ map[func()]v      // ERROR "invalid map key"
	_ map[map[int]int]v // ERROR "invalid map key"
)