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
spurious errors / crashes when pattern matching meets super #8138
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8138?orig=1 |
@DarkDimius said: |
@retronym said:
|
@retronym said: class U {
trait Transformer {
def transform(a: Tree): Tree = ???
}
trait Tree
}
object Test {
def m(u: U) = {
// val u = u0 // works
class C extends u.Transformer {
override def transform(t: u.Tree): u.Tree = {
null match {
case _ =>
// crashes in GenICode:
// error: Unknown type: <notype>, <notype> [class scala.reflect.internal.Types$NoType$, class scala.reflect.internal.Types$NoType$] TypeRef? false
(y: Any) => super.transform(???)
}
???
}
}
}
} |
@retronym said: Not sure about the inference failure yet. |
@retronym said: This amounts to: trait A { def foo(f: Int => String)}
sealed abstract class B1
final class B extends B1 { def foo(f: String => Int)}
object Test {
def foo(a: A) = a match {
case b: B1 =>
b.foo(x => x)
}
} It is a pity that our static checks don't detect the "fruitless type test" here as they would if |
@retronym said: |
@retronym said: def areIrreconcilableAsParents(sym1: Symbol, sym2: Symbol): Boolean = areUnrelatedClasses(sym1, sym2) && (
sym1.initialize.isEffectivelyFinal // initialization important
|| sym2.initialize.isEffectivelyFinal
|| !sym1.isTrait && !sym2.isTrait
|| sym1.isSealed && sym2.isSealed && allChildrenAreIrreconcilable(sym1, sym2) && !currentRun.compiles(sym1) && !currentRun.compiles(sym2) |
The text was updated successfully, but these errors were encountered: