You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importscala.language.dynamicsobjectDynextendsDynamic:defselectDynamic[T](name: String):Option[T] =Nonevala:Option[(Int, Int)] =Dyn.asdf[Tuple2[Int, Int]] // works finevalb:Option[(Int, Int)] =Dyn.selectDynamic[(Int, Int)]("asdf") // works finevalc:Option[(Int, Int)] =Dyn.asdf[(Int, Int)] // fails
Output
scala>importscala.language.dynamics
scala>objectDynextendsDynamic:|defselectDynamic[T](name: String):Option[T] =None|// defined object Dyn
scala>vala:Option[(Int, Int)] =Dyn.asdf[Tuple2[Int, Int]] // works finevala:Option[(Int, Int)] =None
scala>valb:Option[(Int, Int)] =Dyn.selectDynamic[(Int, Int)]("asdf") // works finevalb:Option[(Int, Int)] =None
scala>valc:Option[(Int, Int)] =Dyn.asdf[(Int, Int)] // fails1|valc:Option[(Int, Int)] =Dyn.asdf[(Int, Int)] // fails|^|cannot infer type; expected typeclass dotty.tools.dotc.typer.ProtoTypes$AnyTypeConstructorProto$ is not fully defined
Expectation
the last line val a: Option[(Int, Int)] = Dyn.asdf[(Int, Int)] should return None rather than report an error. Running this in a scala 2.13.4 repl outputs the expected results.
The text was updated successfully, but these errors were encountered:
Minimized code
Output
Expectation
the last line
val a: Option[(Int, Int)] = Dyn.asdf[(Int, Int)]
should returnNone
rather than report an error. Running this in a scala 2.13.4 repl outputs the expected results.The text was updated successfully, but these errors were encountered: