Incomplete subtyping check on cells
Opened this issue · 0 comments
#2085 introduces the possibility to pass in subtypes of components as part of invokes.
The well_formedness
pass currently designates a component a
as a subtype of b
if a
has at least the same ports (w.r.t width, name, direction, and attributes) as b
. In practice this is implemented by comparison of two cells.
Unfortunately, this subtyping check is incomplete because it does not properly check for subtyping correctness of nested ref
cells.
Meaning if component a
expects a ref
cell of a dyn_mem
, and b
has a ref
cell of an axi_dyn_mem
(a subtype of dyn_mem
), b
will still be considered a subtype of a
even though it's not because the memory b
expects is too specific.
Luckily, in practice this can't occur because nested ref
cells are not allowed. When #2079 is implemented this can become a problem.
One thing to note on the implementation side is that a recursive check of subtyping is not immediately available from Cell
comparison because only Component
s have information about cells.
So one would need to access a Component
from a Cell
(this might already exist and be easy?), or change the information compile_invoke
has access to so we can perform a comparison on Component
s directly.