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

Fix bugs with occurs-on constraints #847

Closed krame505 closed 3 months ago

krame505 commented 3 months ago

Changes

Fixes #846.

Inherited occurs-on constraints should only be satisfied for undecorated types, since the constraint means that you can supply an equation for the attribute. If there are only synthesized constraints, passing a reference is fine, because we will decorate it with no additional inherited attributes. This adds an error message when attempting to resolve an inherited occurs-on constraint for a reference.

Also fix a bug introduced in #837, where supplying additional inherited attributes to a shared tree in a polymorphic context could crash if the new array of attributes is smaller.

Also make some tweaks to the fetch-jars script to allow grabbing the latest local jars for a branch - I'm on the road right now and can't feasibly download jars.

Documentation

This is a bug fix, removing an inadvertent undocumented misfeature of satisfying inherited occurs-on constraints for references.

Testing

Added a test for the new error message. Replicating the second problem is non-trivial and nondeterministic, depending on the indices that attributes are dynamically assigned.