Skip to content
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

Presentation compiler complains about Function, expects PartialFunction #7643

Closed
scabug opened this issue Jul 9, 2013 · 9 comments
Closed
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jul 9, 2013

Eclipse, or rather the presentation compiler in version 2.11.0-20130708-160505, reports an error with the following code:

List(1,2) collect {
  case i if i > 5 => i
}

type mismatch; found : Int => Int required: PartialFunction[Int,?]

The actual compiler works fine, it's just the IDE that reports the error.

@scabug
Copy link
Author

scabug commented Jul 9, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7643?orig=1
Reporter: Mirko Stocker (misto)
Affected Versions: 2.11.0-M4
Attachments:

@scabug
Copy link
Author

scabug commented Jul 9, 2013

Mirko Stocker (misto) said:
This caused one of the refactoring tests to fail in today's nightly build, the same test was fine with 2.11.0-20130708-023352, so it could be related to scala/scala@7286324

@scabug
Copy link
Author

scabug commented Jul 9, 2013

@adriaanm said:
Thanks! I'll look into the discrepancy.

@scabug
Copy link
Author

scabug commented Jul 9, 2013

@adriaanm said:
It's the newPatternMatching in https://github.com/scala/scala/blob/72863241ead712ace45071a21b84288959f6ce53/src/compiler/scala/tools/nsc/typechecker/Typers.scala#L2835
Not sure why that is there, but that keeps the PartialFunction synthesis from kicking in in the IDE.

@scabug
Copy link
Author

scabug commented Jul 9, 2013

@retronym said:
Here's the commit that removed the old pattern matcher. I can't remember why the pres compiler didn't completely change to the new scheme.

scala/scala@6084d2d9#L11L100

@scabug
Copy link
Author

scabug commented Jul 9, 2013

@dragos said:
Maybe range positions were too tricky to get right, and this was a temporary solution?

@scabug
Copy link
Author

scabug commented Jul 9, 2013

@adriaanm said:
That sounds both plausible and scary.

@scabug
Copy link
Author

scabug commented Sep 5, 2013

@dragos said:
Presentation compiler test. Place under test/files/presentation.

@scabug
Copy link
Author

scabug commented Sep 5, 2013

@retronym said:
I just flipped the bit to fix this bug, but also to see what else is going to break:

scala/scala#2912

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants