SI-9572 Check for illegal tuple sizes in the parser#4927
Merged
retronym merged 1 commit intoscala:2.11.xfrom Feb 1, 2016
Merged
SI-9572 Check for illegal tuple sizes in the parser#4927retronym merged 1 commit intoscala:2.11.xfrom
retronym merged 1 commit intoscala:2.11.xfrom
Conversation
This commit adds explicit checks with syntax errors for tuple literals and types of more than 22 elements. An alternative approach to fixing SI-9572 would be to revert to the old failure mode of Scala 2.10 where references to arbitrary `scala.TupleXY` would be generated in the parser, which then leads to “type/object not found” errors in the typechecker. This fix here is more intrusive but arguably provides a better user experience. Methods `stripParens` and `makeBinop` are moved from `TreeBuilder` to `Parsers` because they can now generate syntax errors. New methods `makeSafeTupleType` and `makeSafeTupleTerm` implement the error checking on top of `makeTupleType` and `makeTupleTerm`. They are overridden with no-op versions in the quasiquotes parser because it also overrides `makeTupleType` and `makeTupleTerm` in a way that supports arbitrary tuple sizes.
Member
|
LGTM Small tip for next time to help lazy reviewers like me. For changes that necessitate moving chunks of existing code around, split it into two commits: one to move things around without changing behaviour, and another to make the actual change. |
retronym
added a commit
that referenced
this pull request
Feb 1, 2016
SI-9572 Check for illegal tuple sizes in the parser
This was referenced Apr 7, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds explicit checks with syntax errors for tuple literals
and types of more than 22 elements. An alternative approach to fixing
SI-9572 would be to revert to the old failure mode of Scala 2.10 where
references to arbitrary
scala.TupleXYwould be generated in theparser, which then leads to “type/object not found” errors in the
typechecker. This fix here is more intrusive but arguably provides a
better user experience.
Methods
stripParensandmakeBinopare moved fromTreeBuildertoParsersbecause they can now generate syntax errors. New methodsmakeSafeTupleTypeandmakeSafeTupleTermimplement the error checkingon top of
makeTupleTypeandmakeTupleTerm. They are overridden withno-op versions in the quasiquotes parser because it also overrides
makeTupleTypeandmakeTupleTermin a way that supports arbitrary tuple sizes.