Skip to content
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

Generics on selectDynamic appear to get lost in REPL #6320

Closed
scabug opened this issue Sep 6, 2012 · 3 comments
Closed

Generics on selectDynamic appear to get lost in REPL #6320

scabug opened this issue Sep 6, 2012 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Sep 6, 2012

Note that the following works fine when compiled using scalac:

scala> class Dyn(m: Map[String, Any]) extends Dynamic { def selectDynamic[T](s: String): T = m(s).asInstanceOf[T] }
defined class Dyn

scala> new Dyn(Map("foo" -> 10)).foo[Int]
java.lang.ClassCastException: java.lang.Integer cannot be cast to scala.runtime.Nothing$
at .(:9)
at .()
at .(:7)
at .()
at $print()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:732)
at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:981)
at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:571)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:602)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:566)
at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:745)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:790)
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:702)
at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:566)
at scala.tools.nsc.interpreter.ILoop.innerLoop$1(ILoop.scala:573)
at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:576)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:867)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:822)
at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:83)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:105)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

@scabug
Copy link
Author

scabug commented Sep 6, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6320?orig=1
Reporter: @propensive
Affected Versions: 2.10.0-M7

@scabug
Copy link
Author

scabug commented Nov 28, 2012

@paulp said:
scala/scala#1681

@scabug
Copy link
Author

scabug commented Dec 5, 2012

@retronym said:
scala/scala@edbcc64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants