@ethanuppal has mentioned issues that arise when every info is set to empty. This is something that arises from the info_cast macro defined in info.rs:
https://github.com/cucapra/filament/blob/1f9525419ecad50e2ef6c44514939f654c29fc82/crates/ir/src/info.rs#L264-L298
It defines the From trait for infos, which panics if the incorrect info type is found. This is used in certain locations primarily to generate ir::Info::Reasons for constraints (some listed below). These should theoretically just return Info::Empty if either of the parents is missing, rather than panicking, so that we could remove the dependency on info entirely throughout the IR.
We should instead implement TryFrom or instead just directly force the user to use the as_type functions that are already defined.
@ethanuppal has mentioned issues that arise when every info is set to empty. This is something that arises from the
info_cast
macro defined in info.rs: https://github.com/cucapra/filament/blob/1f9525419ecad50e2ef6c44514939f654c29fc82/crates/ir/src/info.rs#L264-L298 It defines theFrom
trait for infos, which panics if the incorrect info type is found. This is used in certain locations primarily to generateir::Info::Reason
s for constraints (some listed below). These should theoretically just returnInfo::Empty
if either of the parents is missing, rather than panicking, so that we could remove the dependency oninfo
entirely throughout the IR.We should instead implement
TryFrom
or instead just directly force the user to use theas_type
functions that are already defined.Non-exhaustive examples
https://github.com/cucapra/filament/blob/1f9525419ecad50e2ef6c44514939f654c29fc82/crates/filament/src/ir_passes/type_check.rs#L28-L36 https://github.com/cucapra/filament/blob/1f9525419ecad50e2ef6c44514939f654c29fc82/crates/filament/src/ir_passes/interval_check.rs#L91-L112