~mna/snow

snow/pkg/codegen/testdata/fn_assign_call_interface.snow.want -rw-r--r-- 678 bytes
424066c5Martin Angers doc: v0.0.5 1 year, 8 months ago
                                                                                
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main

import "fmt"

type _اS struct {
	_اs string
}

func (
	self _اS,
) _اfoo() {
	_اprintln(self._اs)
}

type _ا6اS2 struct {
}

func (
	self _ا6اS2,
) _اfoo() {
	_اprintln("s2")
}

func _ا6اS2اnew(
	s _ا6اS2,
	m map[string]bool,
) _ا6اS2 {
	var r _ا6اS2
	return r
}

func _اSاnew(
	s _اS,
	m map[string]bool,
) _اS {
	var r _اS
	if m["s"] {
		r._اs = s._اs
	}
	return r
}

func _اprintln(
	s string,
) {
	fmt.Println(s)
}

func main() {
	var iface _اI = _اSاnew(_اS{_اs: "hello!"}, map[string]bool{"s": true})
	iface._اfoo()
	iface = _ا6اS2اnew(_ا6اS2{}, map[string]bool{})
	iface._اfoo()
}

type _اI interface {
	_اfoo()
}