Open george-cosma opened 1 month ago
Just a small observation: this does not seem to be an issue for now. In the same_type_fn implemented in pr #26, if I add an import to the wat, all tests pass.
(module
(import "test" "testFunc" (func (param i64 i64) (result i64)))
(func (export "add_one") (param $x i32) (result i32)
local.get $x
i32.const 1
i32.add)
(func (export "add_two") (param $x i32) (result i32)
local.get $x
i32.const 2
i32.add)
)
Although the imported function seems to get the ID of 0 (for type), the functions
section only deals with the functions declared in the module. As such, both functions get parsed as type of ID 1, correctly.
This does not mean the issue is fixed. We still need to be careful when actually implementing imported functions.
According to the specs, imported functions are the first to be assigned an index and only afterwards do the normal functions get assigned indexes.
This issue was discovered when implementing a fix for issue #25 and is created in order to track progress on this potential future bug.