-
Notifications
You must be signed in to change notification settings - Fork 1.1k
REPL breaks when complicated type is inferred #2554
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
Comments
Thanks for reporting @Jasper-M! We will shortly be reimplementing the REPL from scratch. Hopefully, this won't rear its ugly head in the new shiny version! :) |
@felixmulder Actually I take back what I've said in #2991 (I tested with scalac repl...), this breaks the new repl in a different way: scala>
object foo {
trait ShapeLevel
trait FlatShapeLevel extends ShapeLevel
trait ColumnsShapeLevel extends FlatShapeLevel
abstract class Shape[Level <: ShapeLevel, -Mixed, Unpacked, Packed]
object Shape extends TupleShapeImplicits { }
trait TupleShapeImplicits {
implicit final def tuple2Shape[Level <: ShapeLevel, M1,M2, U1,U2, P1,P2](implicit u1: Shape[_ <: Level, M1, U1, P1], u2: Shape[_ <: Level, M2, U2, P2]): Shape[Level, (M1,M2), (U1,U2), (P1,P2)] = ???
}
}
// defined object foo
scala> import foo._
scala> implicit val shape: Shape[_ <: FlatShapeLevel, Int, Int, _] = null
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at dotty.tools.repl.Rendering.valueOf(Rendering.scala:56)
at dotty.tools.repl.Rendering.renderVal(Rendering.scala:75)
at dotty.tools.repl.ReplDriver.$anonfun$displayDefinitions$8(ReplDriver.scala:262)
at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:59)
at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:52)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
at scala.collection.TraversableLike.map(TraversableLike.scala:234)
at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
at scala.collection.AbstractTraversable.map(Traversable.scala:104)
at dotty.tools.repl.ReplDriver.displayMembers$1(ReplDriver.scala:262)
at dotty.tools.repl.ReplDriver.$anonfun$displayDefinitions$15(ReplDriver.scala:289)
at scala.Option.map(Option.scala:146)
at dotty.tools.repl.ReplDriver.$anonfun$displayDefinitions$13(ReplDriver.scala:287)
at dotty.tools.dotc.core.Periods.atPhase(Periods.scala:26)
at dotty.tools.dotc.core.Phases.atPhase(Phases.scala:36)
at dotty.tools.dotc.core.Phases.atPhase$(Phases.scala:35)
at dotty.tools.dotc.core.Contexts$Context.atPhase(Contexts.scala:58)
at dotty.tools.repl.ReplDriver.displayDefinitions(ReplDriver.scala:282)
at dotty.tools.repl.ReplDriver.$anonfun$compile$2(ReplDriver.scala:219)
at scala.util.Either.fold(Either.scala:188)
at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:213)
at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:187)
at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:140)
at dotty.tools.repl.Main$.main(Main.scala:6)
at dotty.tools.repl.Main.main(Main.scala)
Caused by: java.lang.NullPointerException
at dotty.Show$$anon$1.show(Show.scala:16)
at dotty.Show$ShowValue$.show$extension(Show.scala:25)
at rs$line$3$.shapeShow(rs$line$3:1)
at rs$line$3.shapeShow(rs$line$3)
... 30 more
java.lang.RuntimeException: Nonzero exit code returned from runner: 1
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last dotty-repl/compile:runMain for the full output.
[error] (dotty-repl/compile:runMain) Nonzero exit code returned from runner: 1
[error] Total time: 23 s, completed Aug 23, 2017 11:43:43 AM |
My first guess is that there should be a null check when trying to render the rhs of the last val. I'll look into it after lunch :) |
Yes, it seems like that's the issue, will fix asap |
See #3020, there was still an issue with how the types were printed. |
I was trying to investigate something about how dotty infers types that scalac infers as existential "forSome" types. Alas the REPL only shows me an error that seems to come from the code generation phase of the REPL itself.
The text was updated successfully, but these errors were encountered: