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.
7 // Test types of constant expressions, using reflect.
13 func typeof(x interface{}) string { return reflect.TypeOf(x).String() }
15 func f() int { return 0 }
17 func g() int { return 0 }
21 var m = map[string]T{"f": f}
32 if t := typeof(f); t != want {
33 println("type of f is", t, "want", want)
38 if t := typeof(+a); t != want {
39 println("type of +a is", t, "want", want)
42 if t := typeof(a + 0); t != want {
43 println("type of a+0 is", t, "want", want)