Fix WIT extractor ignoring world-level functions#3446
Fix WIT extractor ignoring world-level functions#3446itowlson merged 4 commits intospinframework:mainfrom
Conversation
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
|
Thanks! This is looking good. The only concern I have is that we aren't remapping the cloned function types before inserting into the aggregating world. The test passes because it only uses If this ^ is the case, i can imagine 2 possible fixes:
|
|
Good catch, thanks. I'm blundering in the dark here a bit, but if I can't figure it out I will send up the Bat-signal. |
…later Signed-off-by: itowlson <ivan.towlson@fermyon.com>
|
I spent some time on the user-defined type problem, but there are some complicated shenanigans involved in getting the necessary We were therefore faced with a choice of pulling the feature, or deferring this case and instead giving a clear error when it arose. The proposed approach, which this PR now includes, is to retain the feature with a known limitation on custom records in world level functions. If a user imports such a function, they will get this error: It would be good to revisit this when folks who know this stuff better than I do have more bandwidth for it, but we can be guided by user need on prioritising that. |
Signed-off-by: Brian Hardock <brian.hardock@fermyon.com>
|
@itowlson i pushed some code to my branch/fork that i think addresses the world level difficulties. The code adds a Feel free to take it or leave! |
Add support for world level funcs / types
6be6e93 to
ad3588a
Compare
The WIT extractor currently doesn't handle function imports, where a dep's world exports a function (instead/as well as an interface), and the function is named in the
spin.tomldep.This fixes that.
Thanks to @fibonacci1729 for flagging this bug, and for showing me how to do world-function imports in Spin - now I know what the mystery
Plaincase is for!@fibonacci1729 The way I ended up doing this was yoinking the importised function into the root world (rather than including the world as we originally discussed). This just worked out easier with the existing code.