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
deff(i: =>Int) = i + i
implicitdefups(f: ((=>Int) =>Int)): (Int=>Int) = x => f(x)
valres=List(42).map(f)
work with scalac but fail with dotty even with -language:Scala2
Example come from : scala/bug#11414
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class scala.Function0 (java.lang.Integer is in module java.base of loader 'bootstrap'; scala.Function0 is in unnamed module of loader 'app')
at scala.collection.immutable.List.map(List.scala:286)
at rs$line$1$.<init>(rs$line$1:3)
at rs$line$1$.<clinit>(rs$line$1)
at rs$line$1.res(rs$line$1)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at dotty.tools.repl.Rendering.$anonfun$3(Rendering.scala:57)
at scala.Option.map(Option.scala:163)
at dotty.tools.repl.Rendering.valueOf(Rendering.scala:57)
at dotty.tools.repl.Rendering.renderVal(Rendering.scala:80)
at dotty.tools.repl.ReplDriver.displayMembers$3$$anonfun$3(ReplDriver.scala:274)
at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:237)
at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
at scala.collection.TraversableLike.map(TraversableLike.scala:237)
at scala.collection.TraversableLike.map$(TraversableLike.scala:230)
at scala.collection.AbstractTraversable.map(Traversable.scala:108)
at dotty.tools.repl.ReplDriver.displayMembers$7(ReplDriver.scala:274)
at dotty.tools.repl.ReplDriver.displayDefinitions$$anonfun$3$$anonfun$2(ReplDriver.scala:301)
at scala.Option.map(Option.scala:163)
at dotty.tools.repl.ReplDriver.displayDefinitions$$anonfun$1(ReplDriver.scala:301)
at dotty.tools.dotc.core.Periods.atPhase(Periods.scala:25)
at dotty.tools.dotc.core.Phases.atPhase(Phases.scala:35)
at dotty.tools.repl.ReplDriver.displayDefinitions(ReplDriver.scala:306)
at dotty.tools.repl.ReplDriver.compile$$anonfun$2(ReplDriver.scala:230)
at scala.util.Either.fold(Either.scala:191)
at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:230)
at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:182)
at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:127)
at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:130)
at dotty.tools.repl.ReplDriver.withRedirectedOutput$$anonfun$2$$anonfun$1(ReplDriver.scala:143)
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
at scala.Console$.withErr(Console.scala:196)
at dotty.tools.repl.ReplDriver.withRedirectedOutput$$anonfun$1(ReplDriver.scala:143)
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
at scala.Console$.withOut(Console.scala:167)
at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:143)
at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:130)
at dotty.tools.repl.Main$.main(Main.scala:6)
at dotty.tools.repl.Main.main(Main.scala)
The text was updated successfully, but these errors were encountered:
newca12
changed the title
Eta-expansion for method with by-name paramter fail at runtime
Eta-expansion for method with by-name parameter fail at runtime
Feb 23, 2019
work with scalac but fail with dotty even with -language:Scala2
Example come from : scala/bug#11414
The text was updated successfully, but these errors were encountered: