File: issue-1515.go

package info (click to toggle)
golang-github-traefik-yaegi 0.16.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 24,608 kB
  • sloc: sh: 457; makefile: 39
file content (43 lines) | stat: -rw-r--r-- 412 bytes parent folder | download
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
package main

type I1 interface {
	I2
	Wrap() *S3
}

type I2 interface {
	F()
}

type S2 struct {
	I2
}

func newS2(i2 I2) I1 {
	return &S2{i2}
}

type S3 struct {
	base *S2
}

func (s *S2) Wrap() *S3 {
	i2 := s
	return &S3{i2}
}

type T struct {
	name string
}

func (t *T) F() { println("in F", t.name) }

func main() {
	t := &T{"test"}
	s2 := newS2(t)
	s3 := s2.Wrap()
	s3.base.F()
}

// Output:
// in F test