melt-umn / silver

An attribute grammar-based programming language for composable language extensions
http://melt.cs.umn.edu/silver/
GNU Lesser General Public License v3.0
58 stars 7 forks source link

Flow edges for tree sharing sites miss inherited attributes not in the env #810

Closed krame505 closed 3 months ago

krame505 commented 10 months ago

I just found a significant bug in the flow analysis for decoration via references, e.g. if one were to write

production foo
top::Expr ::= e::Expr
{
  forwards to bar(@e);
}

and another grammar adds a new inherited attribute i on Expr, we wouldn't generate an edge for e.i depending on the vertex for i on the subterm vertex corresponding to the first argument of bar in the forward equation. This means that one could use e.i in an aspect for foo, and we could miss some flow errors like if bar didn't supplies an equation for i on its child.

The fix for this is to add these edges later, in constructProductionGraph, when we have the environment with all inherited attribute occurrences.