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

inherited return type not correctly considered as expected type of pattern matching anon function (-Xoldpatmat / scaladoc) #5933

Closed
scabug opened this issue Jun 16, 2012 · 3 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Jun 16, 2012

abstract class Base[M[_, _]] {
  def foo[A, B]: M[(A, B), Any]
}

class Derived extends Base[PartialFunction] {
  def foo[A, B] /*: PartialFunction[(A, B) => Any]*/ = { case (a, b) => (a: A, b: B) }
}
  ~/code/scala ./build/quick/bin/scalac -Xoldpatmat /Users/jason/code/bugs/arrow-infer/arrow.scala
/Users/jason/code/bugs/arrow-infer/arrow.scala:7: error: type mismatch;
 found   : a.type (with underlying type A[A,B])
 required: A
  def foo[A, B] /*: PartialFunction[(A, B) => Any]*/ = { case (a, b) => (a: A, b: B) }
                                                                         ^
/Users/jason/code/bugs/arrow-infer/arrow.scala:7: error: type mismatch;
 found   : b.type (with underlying type B[A,B])
 required: B
  def foo[A, B] /*: PartialFunction[(A, B) => Any]*/ = { case (a, b) => (a: A, b: B) }
                                                                               ^
two errors found
  ~/code/scala ./build/quick/bin/scaladoc /Users/jason/code/bugs/arrow-infer/arrow.scala
/Users/jason/code/bugs/arrow-infer/arrow.scala:7: error: type mismatch;
 found   : a.type (with underlying type A[A,B])
 required: A
  def foo[A, B] /*: PartialFunction[(A, B) => Any]*/ = { case (a, b) => (a: A, b: B) }
                                                                         ^
/Users/jason/code/bugs/arrow-infer/arrow.scala:7: error: type mismatch;
 found   : b.type (with underlying type B[A,B])
 required: B
  def foo[A, B] /*: PartialFunction[(A, B) => Any]*/ = { case (a, b) => (a: A, b: B) }
                                                                               ^
warning: there were 1 feature warnings; re-run with -feature for details
model contains 3 documentable templates
one warning found
two errors found
  ~/code/scala ./build/quick/bin/scalac /Users/jason/code/bugs/arrow-infer/arrow.scala
warning: there were 1 feature warnings; re-run with -feature for details
one warning found

a.type (with underlying type A[A,B]) is pretty messed up. Why does this affect Scaladoc? Does it miss out on some essential goodness from virtpatmat?

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jun 16, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5933?orig=1
Reporter: @retronym
Affected Versions: 2.10.0

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Jul 23, 2012

@adriaanm said:
scala/scala#980

btw, this compiles without errors these days

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Aug 8, 2012

@scabug scabug closed this Aug 8, 2012
@scabug scabug added this to the 2.10.0-M6 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.