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
57 stars 7 forks source link

Fix bug with check for missing remote equations #759

Closed krame505 closed 1 year ago

krame505 commented 1 year ago

Changes

This fixes an issue with chaining multiple levels of decoration through references across multiple productions:

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

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

production baz
top::Expr ::= e::Expr
{
  e.env = top.env;
}

foo depends on e.env, but this equation is in baz, not bar. We need to find all decoration sites for e, and ensure that there is an env equation at any of them.

Documentation

Added source comments and a test case.

krame505 commented 1 year ago

I discovered that there is a related issue in the translation for this scenario that requires a bit of refactoring - will be another PR shortly.