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
Type alias in package object causes type checker assertion failure #6084
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6084?orig=1
|
@paulp said: package object foo { type X[T, U] = (T => U) }
package foo {
abstract class Foo[T, U](val d: T => U) extends (T => U) {
def f1(r: X[T, U]) = r match { case x: Foo[_,_] => x.d } // inferred ok
def f2(r: X[T, U]): (T => U) = r match { case x: Foo[_,_] => x.d } // dealiased ok
def f3(r: X[T, U]): X[T, U] = r match { case x: Foo[_,_] => x.d } // alias not ok
// x.d : foo.this.package.type.X[?scala.reflect.internal.Types$NoPrefix$?.T, ?scala.reflect.internal.Types$NoPrefix$?.U] ~>scala.this.Function1[?scala.reflect.internal.Types$NoPrefix$?.T, ?scala.reflect.internal.Types$NoPrefix$?.U]
// at scala.Predef$.assert(Predef.scala:170)
// at scala.tools.nsc.Global.assert(Global.scala:235)
// at scala.tools.nsc.ast.TreeGen.mkCast(TreeGen.scala:252)
// at scala.tools.nsc.typechecker.Typers$Typer.typedCase(Typers.scala:2263)
}
} |
Tony Sloane (asloane) said: |
@retronym said: |
@retronym said: |
@paulp said: |
@paulp said: |
Tony Sloane (asloane) said: |
The program below causes a crash, apparently due to the type alias in the package object. The commented out version compiles without a crash. See the attachment for the stack trace.
Code similar to this has been present in our Kiama library for quite a while and has compiled fine with the 2.9 series compilers.
The text was updated successfully, but these errors were encountered: