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
Regression: NPE in typer when reporting type error #7636
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7636?orig=1 |
@cvogt said:
|
@paulp said: class Foo[A](x: A)
object bar extends Foo(5: T forSome { type T })
// a.scala:2: error: illegal inheritance;
// self-type bar.type does not conform to Foo[T]'s selftype Foo[T]
// object bar extends Foo(5: T forSome { type T })
// ^
// a.scala:2: error: type mismatch;
// found : T(in constructor bar) where type T(in constructor bar)
// required: <empty>.T where type <empty>.T
// object bar extends Foo(5: T forSome { type T })
// ^
// two errors found That error message says, in effect, "Bug City." You never know what's going to end up owning certain kinds of symbols; neither does the compiler, which is requiring a T owned by the empty package (i.e. the enclosing package class.) |
@cvogt said: |
@cvogt said: |
@paulp said: This compiles, hopefully that answers your question. class Foo[A](x: A)
object bar extends Foo[T forSome { type T }](5) |
@cvogt said: |
@cvogt said (edited on Jul 14, 2013 5:02:21 AM UTC): |
@retronym said (edited on Jul 15, 2013 1:26:33 AM UTC): val cbody2 = { // called both during completion AND typing.
val typer1 = newTyper(cscope)
// XXX: see about using the class's symbol....
clazz.unsafeTypeParams foreach (sym => typer1.context.scope.enter(sym))
typer1.namer.enterValueParams(vparamss map (_.map(_.duplicate)))
typer1.typed(cbody1)
} I'm not sure how to fix that. |
@cvogt said: |
@retronym said: |
@gkossakowski said: |
This bug is not related to the particular type error happening here, but a generic bug in error reporting. It makes debugging type errors impossible when it happens as the errors won't show. Regression and probably easily fixed.
leads to a type error in 2.9.2 but crashes the typer with a NullPointerException in 2.10.2 and 2.11 snapshot.
The text was updated successfully, but these errors were encountered: