aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-04-05 14:25:30 +0200
committerRon Evans <[email protected]>2019-04-06 08:32:28 +0200
commit38c3d0852e16e74f73723ae6e121feac22e871b3 (patch)
treefc805d631ae5948981e22ac7b2c371fc20011bea /testdata
parent85f2ef40f83fee8869654f8b2d44ac70e71fc71b (diff)
downloadtinygo-38c3d0852e16e74f73723ae6e121feac22e871b3.tar.gz
tinygo-38c3d0852e16e74f73723ae6e121feac22e871b3.zip
compiler: implement casting named structs and pointers to them
Diffstat (limited to 'testdata')
-rw-r--r--testdata/structs.go (renamed from testdata/structexpand.go)18
-rw-r--r--testdata/structs.txt (renamed from testdata/structexpand.txt)2
2 files changed, 20 insertions, 0 deletions
diff --git a/testdata/structexpand.go b/testdata/structs.go
index 77613b2aa..4ff5068d5 100644
--- a/testdata/structexpand.go
+++ b/testdata/structs.go
@@ -28,6 +28,14 @@ type s4 struct {
d byte
}
+// same struct, different type
+type s4b struct {
+ a byte
+ b byte
+ c byte
+ d byte
+}
+
type s5 struct {
a struct {
aa byte
@@ -70,6 +78,16 @@ func test3(s s3) {
func test4(s s4) {
println("test4", s.a, s.b, s.c, s.d)
+ test4b(s4b(s))
+ test4bp((*s4b)(&s))
+}
+
+func test4b(s s4b) {
+ println("test4b", s.a, s.b, s.c, s.d)
+}
+
+func test4bp(s *s4b) {
+ println("test4bp", s.a, s.b, s.c, s.d)
}
func test5(s s5) {
diff --git a/testdata/structexpand.txt b/testdata/structs.txt
index 2cfc411a1..b94ce0344 100644
--- a/testdata/structexpand.txt
+++ b/testdata/structs.txt
@@ -3,6 +3,8 @@ test1 1
test2 1 2
test3 1 2 3
test4 1 2 3 4
+test4b 1 2 3 4
+test4bp 1 2 3 4
test5 1 2 3
test6 foo 3 5
test7 (0:nil) 8