This adds support for decoration-site flow projections.
The major additions required for this are:
A new inherited attribute decSiteVertexInfo :: Maybe<VertexType>, containing the flow vertex corresponding to the decoration site where this expression will ultimately be decorated.
A new inherited attribute alwaysDecorated, determining whether this expression is decorated unconditionally. Note that there are cases where an expression has a known decoration site, but we cannot rely on it always being decorated.
For example in forwards to if cond then @foo else errorExpr(...); we can't project inherited equations supplied to foo through forwarding, but we can say that foo.env may depend on top.env when checking for hidden transitive dependencies.
A new FlowVertex/VertexType/FlowDef, subtermVertex/subtermVertexType/subtermDecEq, for expressions that occur as decorable arguments to a production call that has a decSiteVertexInfo.
New FlowDefs for tracking unique references to children/locals in places that have a decSiteVertexInfo.
Added flow checks for supplying explicit equations to a child/local that has a unique ref decoration site, to avoid introducing hidden transitive dependencies that exceed the dependencies of the projected equation.
Changes to the translation for taking non-unique references to a child or local that has a unique reference taken, where we might be relying on the child/local having been decorated there first.
The actual projection machinery in the flow inference driver was already there for pattern var flow projections, and could be reused pretty much unchanged.
This feature isn't documented yet. I'm unsure how to proceed here, as an explanation of this is tied up in a larger discussion of unique references (which may be subject to change with #751) and approaches to forwarding. This will be laid out in my thesis proposal/a potential SLE paper, but I'm not sure if I should write something up for the website before merging this.
Comments have been added in the implementation as needed.
Changes
This adds support for decoration-site flow projections.
The major additions required for this are:
decSiteVertexInfo :: Maybe<VertexType>
, containing the flow vertex corresponding to the decoration site where this expression will ultimately be decorated.alwaysDecorated
, determining whether this expression is decorated unconditionally. Note that there are cases where an expression has a known decoration site, but we cannot rely on it always being decorated. For example inforwards to if cond then @foo else errorExpr(...);
we can't project inherited equations supplied tofoo
through forwarding, but we can say thatfoo.env
may depend ontop.env
when checking for hidden transitive dependencies.FlowVertex
/VertexType
/FlowDef
,subtermVertex
/subtermVertexType
/subtermDecEq
, for expressions that occur as decorable arguments to a production call that has adecSiteVertexInfo
.FlowDef
s for tracking unique references to children/locals in places that have adecSiteVertexInfo
.The actual projection machinery in the flow inference driver was already there for pattern var flow projections, and could be reused pretty much unchanged.
See https://github.com/melt-umn/silver/compare/feature/dec-site-projections...feature/use-dec-site-projections for some changes using this feature in the Silver compiler; this will be submitted in a subsequent pull request.
Documentation
This feature isn't documented yet. I'm unsure how to proceed here, as an explanation of this is tied up in a larger discussion of unique references (which may be subject to change with #751) and approaches to forwarding. This will be laid out in my thesis proposal/a potential SLE paper, but I'm not sure if I should write something up for the website before merging this.
Comments have been added in the implementation as needed.