Skip to content

Remove dead code in pattern matching #2157

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

Merged
merged 2 commits into from
Apr 1, 2017

Conversation

OlivierBlanvillain
Copy link
Contributor

This entry point to pattern matching is apparently unreachable.

  • The first commit removes that case and the parts that become unreachable.
  • The second commit removes tupleExtractor which in also unreachable in dotty.
  • Third commit squashes two class together, with the dead code remove it becomes useless inheritance

Copy link
Contributor

@DarkDimius DarkDimius left a comment

Choose a reason for hiding this comment

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

First two commits, LGTM.
I'm not sure about the third one. I believe there's a value in keeping same structure that scalac had.

protected def seqTree(binder: Symbol) = tupleSel(binder)(firstIndexingBinder + 1)
protected def tupleSel(binder: Symbol)(i: Int): Tree = {
private def seqTree(binder: Symbol): Tree =
if (firstIndexingBinder == 0) ref(binder)
Copy link
Contributor

Choose a reason for hiding this comment

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

this isn't a refactoring, why did you need this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

def resultInMonad =
if (aligner.isBool) defn.UnitType
else if (isProductMatch(resultType, aligner.prodArity)) resultType
else if (isGetMatch(resultType)) extractorMemberType(resultType, nme.get)
else resultType

def resultType: Type

/** Create the TreeMaker that embodies this extractor call
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be nice to preserve documentation

@OlivierBlanvillain
Copy link
Contributor Author

Alright, removed the 3rd commit.

@felixmulder felixmulder merged commit 054a4f9 into scala:master Apr 1, 2017
@allanrenucci allanrenucci deleted the patmat-dead-code branch December 14, 2017 19:24
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