Improve handling of types and aliases in components (#5591)
This commit fixes more cases from #5565 where `export` items introducing indices wasn't handled by accident. Additionally this fixes support for aliasing types from instances which largely wasn't working before. Most of the fixes here are about correctly maintaining Wasmtime's view of the type index spaces.
This commit is contained in:
@@ -246,3 +246,77 @@
|
||||
(type $t101 (list $t100))
|
||||
)
|
||||
"type nesting is too deep")
|
||||
|
||||
(component
|
||||
(type (instance
|
||||
(export $x "x" (instance
|
||||
(type $t u32)
|
||||
(export "y" (type (eq $t)))
|
||||
))
|
||||
(alias export $x "y" (type $t))
|
||||
(export "my-y" (type (eq $t)))
|
||||
))
|
||||
|
||||
(type (component
|
||||
(import "x" (instance $x
|
||||
(type $t u32)
|
||||
(export "y" (type (eq $t)))
|
||||
))
|
||||
(alias export $x "y" (type $t))
|
||||
(export "my-y" (type (eq $t)))
|
||||
))
|
||||
)
|
||||
|
||||
(component
|
||||
(type $t u32)
|
||||
(export $t2 "t" (type $t))
|
||||
(type $r (record (field "x" $t2)))
|
||||
(export "r" (type $r))
|
||||
)
|
||||
|
||||
(component
|
||||
(component
|
||||
(import "x" (instance $i
|
||||
(type $i u32)
|
||||
(export "i" (type (eq $i)))
|
||||
))
|
||||
(alias export $i "i" (type $i))
|
||||
(export "i" (type $i))
|
||||
)
|
||||
)
|
||||
|
||||
(component
|
||||
(type $u u32)
|
||||
(instance $i
|
||||
(export "i" (type $u))
|
||||
)
|
||||
(alias export $i "i" (type $i))
|
||||
(export "i" (type $i))
|
||||
)
|
||||
|
||||
(component
|
||||
(component $c
|
||||
(type $t u32)
|
||||
(export "t" (type $t))
|
||||
)
|
||||
(instance $c (instantiate $c))
|
||||
(export "i" (type $c "t"))
|
||||
)
|
||||
|
||||
(component
|
||||
(component $c
|
||||
(import "x" (component $c
|
||||
(type $t u32)
|
||||
(export "t" (type (eq $t)))
|
||||
))
|
||||
(instance $c (instantiate $c))
|
||||
(export "i" (type $c "t"))
|
||||
)
|
||||
|
||||
(component $x
|
||||
(type $t u32)
|
||||
(export "t" (type $t))
|
||||
)
|
||||
|
||||
(instance $c (instantiate $c (with "x" (component $x))))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user