mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
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.
This commit is contained in:
committed by
Ron Evans
parent
a04db67ea9
commit
33dc4b5121
Vendored
+8
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user