diff options
author | Ayke van Laethem <[email protected]> | 2019-08-02 16:58:42 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2019-08-05 14:44:30 +0200 |
commit | 33dc4b5121e570d17d045bd35d5dac5b521d8a7c (patch) | |
tree | f86c33fa7248e96b319e5daaafabce9d33bdd196 /testdata/interface.go | |
parent | a04db67ea9d882eed9164321bcb503f76a65d2f1 (diff) | |
download | tinygo-33dc4b5121e570d17d045bd35d5dac5b521d8a7c.tar.gz tinygo-33dc4b5121e570d17d045bd35d5dac5b521d8a7c.zip |
compiler: fix crash with linked lists in interfaces
This commit fixes the following issue:
https://github.com/tinygo-org/tinygo/issues/309
Also, it prepares for some other reflect-related changes that should
make it easier to add support for named types (etc.) in the future.
Diffstat (limited to 'testdata/interface.go')
-rw-r--r-- | testdata/interface.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/testdata/interface.go b/testdata/interface.go index 3c6871d85..69c3b32cf 100644 --- a/testdata/interface.go +++ b/testdata/interface.go @@ -22,6 +22,10 @@ func main() { println("Stringer.(*Thing).String():", itf.(Stringer).String()) println("nested switch:", nestedSwitch('v', 3)) + + // Try putting a linked list in an interface: + // https://github.com/tinygo-org/tinygo/issues/309 + itf = linkedList{} } func printItf(val interface{}) { @@ -134,3 +138,7 @@ func (p SmallPair) Print() { type Unmatched interface { NeverImplementedMethod() } + +type linkedList struct { + addr *linkedList +} |