tinygo
tinygo copied to clipboard
cgo: fixes panic when FuncType.Results is nil
FuncType.Results can be nil. This fixes the comparison and backfills relevant tests.
Fixes #3096
macOS failure looks like the same as #2892 ?
tinygo:ld.lld: error: undefined symbol: _notARealFunction
[19703](https://github.com/tinygo-org/tinygo/runs/8221221002?check_suite_focus=true#step:12:19704)
>>> referenced by /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/tinygo492537698/main.o
[19704](https://github.com/tinygo-org/tinygo/runs/8221221002?check_suite_focus=true#step:12:19705)
failed to run tool: ld.lld
[19705](https://github.com/tinygo-org/tinygo/runs/8221221002?check_suite_focus=true#step:12:19706)
--- FAIL: TestFail (0.00s)
[19706](https://github.com/tinygo-org/tinygo/runs/8221221002?check_suite_focus=true#step:12:19707)
fail
[19707](https://github.com/tinygo-org/tinygo/runs/8221221002?check_suite_focus=true#step:12:19708)
FAIL
The _notARealFunction error message is noise. It just tests for a linker error, which results in some output on stderr. We should make this less confusing by redirecting stderr.
@codefromthecrypt did you see @aykevl comment on this PR?
https://github.com/tinygo-org/tinygo/pull/3136#pullrequestreview-1100940709
@deadprogram thanks I missed it. yeap I can add a second layer test beyond the unit tests. np
@FGadvancer I fixed the bug, but we should have an integration test that makes sure it stays fixed. Can you paste the code that led to this panic? It is better than me wildly guessing.
It took a while for me to figure out from the stack trace what the bug was, but am over budget doing more than work provided. If someone is interested in raising a PR to obviate this adding the second layer of tests, works for me. If only one layer of tests isn't good enough and this bug is tolerable meanwhile, I also don't mind if someone closes this.
This seems better than it is right now, at the very least. Now squash/merging thank you for the code @codefromthecrypt