blob: 143aff04f6a472e7bb2728208ad30e4b1d93ac55 [file] [log] [blame]
Russ Cox0b477ef2012-02-16 23:48:57 -05001// errorcheck
Russ Cox81be9152009-06-19 14:00:39 -07002
3// Copyright 2009 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
Rob Pikefc0dc042012-02-19 13:19:43 +11007// Verify allowed and disallowed conversions.
8// Does not compile.
9
Russ Cox81be9152009-06-19 14:00:39 -070010package main
11
12// everything here is legal except the ERROR line
13
14var c chan int
15var d1 chan<- int = c
16var d2 = (chan<- int)(c)
17
18var e *[4]int
Ian Lance Taylor5309fae2010-08-31 07:34:01 -070019var f1 []int = e[0:]
20var f2 = []int(e[0:])
Russ Cox81be9152009-06-19 14:00:39 -070021
22var g = []int(nil)
23
Russ Cox565b5dc2010-06-08 18:50:02 -070024type H []int
Russ Cox81be9152009-06-19 14:00:39 -070025type J []int
Russ Cox565b5dc2010-06-08 18:50:02 -070026
Russ Cox81be9152009-06-19 14:00:39 -070027var h H
Russ Cox565b5dc2010-06-08 18:50:02 -070028var j1 J = h // ERROR "compat|illegal|cannot"
Russ Cox81be9152009-06-19 14:00:39 -070029var j2 = J(h)