OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [convert.go] - Blame information for rev 700

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// $G $D/$F.go && $L $F.$A && ./$A.out
2
 
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
 
7
package main
8
 
9
import "reflect"
10
 
11
func typeof(x interface{}) string { return reflect.TypeOf(x).String() }
12
 
13
func f() int { return 0 }
14
 
15
func g() int { return 0 }
16
 
17
type T func() int
18
 
19
var m = map[string]T{"f": f}
20
 
21
type A int
22
type B int
23
 
24
var a A = 1
25
var b B = 2
26
var x int
27
 
28
func main() {
29
        want := typeof(g)
30
        if t := typeof(f); t != want {
31
                println("type of f is", t, "want", want)
32
                panic("fail")
33
        }
34
 
35
        want = typeof(a)
36
        if t := typeof(+a); t != want {
37
                println("type of +a is", t, "want", want)
38
                panic("fail")
39
        }
40
        if t := typeof(a + 0); t != want {
41
                println("type of a+0 is", t, "want", want)
42
                panic("fail")
43
        }
44
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.