Skip to content

Fix MatchError: InfixOp on TreeAccumulator #3487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

OlivierBlanvillain
Copy link
Contributor

In case of errors it may be that typed trees point to untyped ones. I think it makes sense to avoid the MatchError in that case, not only in Interative mode.

In case of errors it may be that typed trees point to untyped ones.
I think it makes sense to avoid the MatchError in that case, not only in
Interative mode.
@allanrenucci
Copy link
Contributor

This code snippet also causes a match error because of an untyped tree.

class Test[T](f: List[String] => T)

object o {
  implicit object a extends Test(_ map identity)
  implicit object b extends Test(_ map identity)
}

Not sure it is related

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was a scenario where the error happened? Can it be avoided? If possible I'd like to keep the assert because it looks useful to flag error situations.

@OlivierBlanvillain
Copy link
Contributor Author

The test case included in the PR throws a match error on master (note that F is undefined)

@@ -1325,7 +1325,7 @@ object Trees {
this(this(x, arg), annot)
case Thicket(ts) =>
this(x, ts)
case _ if ctx.mode.is(Mode.Interactive) =>
case _ =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposal: replace with

case _ if ctx.errorsReported || ctx.mode.is(Mode.Interactive) =>

and adapt the comment to say that in interactive mode, errors might come from previous runs.

@OlivierBlanvillain OlivierBlanvillain merged commit 759daf2 into scala:master Feb 12, 2018
@allanrenucci allanrenucci deleted the fix-match-error-in-tree-accumulator branch February 12, 2018 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants