| Welcome to Scala 2.12.0-M5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45). | |
| Type in expressions for evaluation. Or try :help. | |
| scala> case class Foo(x: Int) | |
| defined class Foo | |
| scala> implicit def foo: Foo = Foo(1) | |
| foo: Foo | |
| scala> implicitly[Foo] | |
| res0: Foo = Foo(1) | |
| scala> implicit def foo: Foo = Foo(2) | |
| foo: Foo | |
| scala> implicitly[Foo] | |
| res1: Foo = Foo(2) | |
| scala> implicit def foo2: Foo = Foo(3) | |
| foo2: Foo | |
| scala> implicitly[Foo] | |
| <console>:18: error: ambiguous implicit values: | |
| both method foo of type => Foo | |
| and method foo2 of type => Foo | |
| match expected type Foo | |
| implicitly[Foo] | |
| ^ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment