GaloisInc / saw-script

The SAW scripting language.
BSD 3-Clause "New" or "Revised" License
442 stars 63 forks source link

Improve AST-level source position tracking. #2076

Closed sauclovian-g closed 3 months ago

sauclovian-g commented 4 months ago

This is the first chunk of work on #2071.

Track positions explicitly in every expression and pattern constructor (but not types, yet); kill off the Eq instances this renders problematic (or were already problematic). Kill off the Eq instance for Type too and clean up the things that were trying to use it.

sauclovian-g commented 4 months ago

I would appreciate fairly close attention to 10dbb257ebfddbf6a85e294ef8664a4e507289fa, because even though it's fairly simple it's the kind of thing where if you botch it up you'll still be finding problems three years later. (Recommend looking at that commit by itself for this.)

sauclovian-g commented 4 months ago

The case in question is: let foo () : String = 3;, which in the new regime reports the location of 3 and in the old world reports the whole span from foo to 3.

Sticking it in the test suite raises some other questions though (mostly about how to prepare for #2075); not opposed to doing it but those questions probably ought to get answered first. See other message elsewhere...

RyanGlScott commented 4 months ago

I propose one way to handle adding test cases of this sort in https://github.com/GaloisInc/saw-script/issues/2075#issuecomment-2242724266.

sauclovian-g commented 3 months ago

Force-push was to rebase on master -- the only things in master since this branch started were submodule bumps, which are extremely unlikely to interact with the things I've been doing.

(merged with master first so the force-push comparison gh offers will come out identical)

sauclovian-g commented 3 months ago

(careful examination will also reveal that I squashed the "rename test dir" commit; there's no point preserving that glitch, plus git's shortcomings with rename handlings make it better to avoid having any when the opportunity arises)