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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [fixedbugs/] [bug248.dir/] [bug3.go] - Blame information for rev 700

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
package main
2
 
3
import (
4
        p0 "./bug0"
5
        p1 "./bug1"
6
)
7
 
8
// both p0.T and p1.T are struct { X, Y int }.
9
 
10
var v0 p0.T
11
var v1 p1.T
12
 
13
// interfaces involving the two
14
 
15
type I0 interface {
16
        M(p0.T)
17
}
18
 
19
type I1 interface {
20
        M(p1.T)
21
}
22
 
23
// t0 satisfies I0 and p0.I
24
type t0 int
25
 
26
func (t0) M(p0.T) {}
27
 
28
// t1 satisfies I1 and p1.I
29
type t1 float64
30
 
31
func (t1) M(p1.T) {}
32
 
33
// check static interface assignments
34
var i0 I0 = t0(0) // ok
35
var i1 I1 = t1(0) // ok
36
 
37
var i2 I0 = t1(0) // ERROR "does not implement|incompatible"
38
var i3 I1 = t0(0) // ERROR "does not implement|incompatible"
39
 
40
var p0i p0.I = t0(0) // ok
41
var p1i p1.I = t1(0) // ok
42
 
43
var p0i1 p0.I = t1(0) // ERROR "does not implement|incompatible"
44
var p0i2 p1.I = t0(0) // ERROR "does not implement|incompatible"
45
 
46
func main() {
47
        // check that cannot assign one to the other,
48
        // but can convert.
49
        v0 = v1 // ERROR "assign"
50
        v1 = v0 // ERROR "assign"
51
 
52
        v0 = p0.T(v1)
53
        v1 = p1.T(v0)
54
 
55
        i0 = i1   // ERROR "cannot use|incompatible"
56
        i1 = i0   // ERROR "cannot use|incompatible"
57
        p0i = i1  // ERROR "cannot use|incompatible"
58
        p1i = i0  // ERROR "cannot use|incompatible"
59
        i0 = p1i  // ERROR "cannot use|incompatible"
60
        i1 = p0i  // ERROR "cannot use|incompatible"
61
        p0i = p1i // ERROR "cannot use|incompatible"
62
        p1i = p0i // ERROR "cannot use|incompatible"
63
 
64
        i0 = p0i
65
        p0i = i0
66
 
67
        i1 = p1i
68
        p1i = i1
69
}

powered by: WebSVN 2.1.0

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