We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The following code compiles fine on 2.9.3-RC1, but fails with a type mismatch error on 2.10.0.
type mismatch
package tree abstract class Tree { type FinalBranch <: Branch trait Branch { this: FinalBranch => def myself: FinalBranch = this } } object Matcher { def unapply[T <: Tree](branch: T#Branch) = Some(branch.myself) } object Helper { def itself[T <: Tree](branch: T#Branch) = branch.myself def optionItself[T <: Tree](branch: T#Branch) = Some(branch.myself) } object Oak extends Tree { type FinalBranch = Branch class Branch extends super.Branch { this: FinalBranch => } } object Caller extends App { val oakBranch = new Oak.Branch println(oakBranch.getClass()) // <-- class tree.Oak$Branch val naked = Helper.itself(oakBranch) println(naked.getClass()) // <-- class tree.Oak$Branch val unwrapped = Helper.optionItself(oakBranch).get println(unwrapped.getClass()) // <-- class tree.Oak$Branch val matched = oakBranch match { case Matcher(branch) => branch // <-- type mismatch; found: T#Branch; required: Oak.Branch } }
The error:
$ scalac tree/Tree.scala tree/Tree.scala:38: error: type mismatch; found : T#Branch required: tree.Oak.Branch case Matcher(branch) => branch // <-- type mismatch; found: T#Branch; required: Oak.Branch ^ one error found
This error was first reported to Scala IDE in ticket #1001404.
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-6951?orig=1 Reporter: @skyluc Affected Versions: 2.10.0
Sorry, something went wrong.
@retronym said: Working on a fix: https://github.com/retronym/scala/compare/ticket/6951
@retronym said: scala/scala#1887
retronym
No branches or pull requests
The following code compiles fine on 2.9.3-RC1, but fails with a
type mismatch
error on 2.10.0.The error:
This error was first reported to Scala IDE in ticket #1001404.
The text was updated successfully, but these errors were encountered: