You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix type operator precedence levels in parser & pretty-printer
The correct precedence levels are up for debate, but this patch follows the
spec, while encapsulating the precedence rules in `parsing.precedence`.
* According to the spec, term- and type-level operators precedences are
different, so add an `isType` flag to `parsing.precedence` and add
constants for `AndTypePrec` and `OrTypePrec` (distinct from `OrPrec` and
`AndPrec`, which is now unused and dropped).
* In the parser, consider `isType` to decide priority.
* In the pretty-printer, use `AndTypePrec` and `OrTypePrec` where appropriate.
And since the operators are left-associative, increase precedence for right
operands, for both `Type`s and `TypeTree`s.
* RefinedPrinter: Handle associativity mismatches for Type operators.
* Add Documentation/tutorial on how to use atPrec and changePrec correctly,
since so much code got it wrong and it takes a while to get it.
* Fix printing for AndTypeTree and OrTypeTree along AndType and OrType.
* Extend tests for Type printing.
* PrinterTests: Add first test for TypeTree printing.
* PrinterTests: disable colors, following ErrorMessagesTest.scala.
0 commit comments