Created
April 1, 2015 12:08
-
-
Save mpilquist/aa7d0e4b7372d6bb97af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package object foo { | |
class FooOps[A](self: A) { | |
def foo: Int = self.## | |
} | |
implicit def toFooOps[A](a: A): FooOps[A] = new FooOps[A](a) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package object foo { | |
class FooOps[A](val self: A) extends AnyVal { | |
def foo: Int = self.## | |
} | |
implicit def toFooOps[A](a: A): FooOps[A] = new FooOps[A](a) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scalac foo-v1.scala | |
scalac -cp . MyApp.scala | |
scala -cp . MyApp | |
scalac foo-v2.scala | |
scala -cp . MyApp | |
java.lang.NoSuchMethodError: foo.package$.toFooOps(Ljava/lang/Object;)Lfoo/package$FooOps; | |
at MyApp$.delayedEndpoint$MyApp$1(bar.scala:4) | |
at MyApp$delayedInit$body.apply(bar.scala:3) | |
at scala.Function0$class.apply$mcV$sp(Function0.scala:40) | |
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12) | |
at scala.App$$anonfun$main$1.apply(App.scala:76) | |
at scala.App$$anonfun$main$1.apply(App.scala:76) | |
at scala.collection.immutable.List.foreach(List.scala:381) | |
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35) | |
at scala.App$class.main(App.scala:76) | |
at MyApp$.main(bar.scala:3) | |
at MyApp.main(bar.scala) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import foo._ | |
object MyApp extends App { | |
println(this.foo) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment