Throw error if code formatting ever changes semantics #3194
Labels
Error Messages
An error message is not descriptive enough
Language
Regarding Squiggle language semantics, distributions and function registry
Web components
Description of suggestion or shortcoming:
We've had a few code formatting bugs before. These can be really annoying for users, as they can be difficult to detect and debug (they often don't leave errors, just change code).
It seems good to check the AST before+after, and make sure these are identical semantically. If they aren't, throw an error, instead of formatting.
I started trying this.
In
useFormatSIquiggleExtension.ts
Here, I found that the AST does change based on the
location
objects, which makes sense, even though these don't have semantic meaning. So we'd need to detect changes other thanlocation
changes.One easy way to do this is to write a single-use script that converts the data into JSON, then scrubs the locations, then checks for equality.
A better way would probably be something like adding parameterized
isEqual
methods forASTNode
.The text was updated successfully, but these errors were encountered: