mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
4957db89f4
When the underlying value of an interface does not fit in a pointer, a pointer to the value was correctly inserted in the heap. However, the receiving method still assumed it got the underlying value instead of a pointer to it leading to a crash. This commit inserts wrapper functions for method calls on interfaces. The bug wasn't obvious as on a 64-bit system, the underlying value was almost always put directly in the interface. However, it led to a crash on the AVR platform where pointer are (usually) just 16 bits making it far more likely that underlying values cannot be directly stored in an interface.
14 lines
212 B
Plaintext
14 lines
212 B
Plaintext
thing: foo
|
|
Thing.Print: foo
|
|
is int: 5
|
|
is byte: 120
|
|
is string: foo
|
|
is Thing: foo
|
|
is *Thing: foo
|
|
is *Thing: foo
|
|
is Doubler: 6
|
|
is Tuple: 1 7 11 13
|
|
Array len: 4
|
|
Stringer.String(): foo
|
|
Stringer.(*Thing).String(): foo
|