tylr icon indicating copy to clipboard operation
tylr copied to clipboard

Better remolding

Open dm0n3y opened this issue 1 year ago • 0 comments

Relaxes assumption made for remolding optimization in https://github.com/hazelgrove/tylr/pull/9 that tiles should have same nib sorts as output sort, in exchange for other assumptions that match our grammars so far:

  • right nib shapes are never ambiguous for a given label
  • filtering molds by shape before sort does not create unnecessary sort inconsistencies (imprecise but enough for handling unary/binary minus and paren/ap)

This change may also have uncovered a bug where remolding should in general take place beyond the focal segment, eg any segment directly contained by or directly containing put down shards, but this was an existing bug introduced by https://github.com/hazelgrove/tylr/pull/9 so not fixing here. Concretely this is observed when picking up an = in a let and putting back down with caret ending up in the let definition, which leaves the pattern sort-inconsistent. I think previous optimization happened to get away with this because it happened to preserve the original pattern mold, but the proper fix is to reassign molds beyond focal segment.

dm0n3y avatar Jul 29 '22 17:07 dm0n3y