metaborg / stratego

Apache License 2.0
10 stars 6 forks source link

Added warning on simple matching congruences (generalising a previous warning) #4

Closed Apanatshka closed 6 years ago

Apanatshka commented 6 years ago

Previously the editor warned you when you specifically wrote debug("message") that you should use debug(!"message") instead. This is because "message" is in a strategy position, which makes it a congruence, both matching and building against the string literal. This warning was specialised to the debug strategy. I've now generalised the warning to find any congruences with only congruences as sub-strategies and put a warning on them. So if somewhere in a strategy position you use SVar("main_0_0") you will get a warning telling you that this is a simple matching congruence and you should prefix it with a ? (which preserves the behaviour but it more explicit); or prefix it with a ! if you meant to build the term.