Advertisement
Guest User

scala error self type

a guest
Aug 7th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.62 KB | None | 0 0
  1. scala> :paste
  2. // Entering paste mode (ctrl-D to finish)
  3.  
  4. trait A { def x = "foo" }
  5. object A { self: A => println(self.x) }
  6.  
  7. // Exiting paste mode, now interpreting.
  8.  
  9. <console>:8: error: type mismatch;
  10.  found   : A.type
  11.  required: ?{def x: ?}
  12. Note that implicit conversions are not applicable because they are ambiguous:
  13.  both method any2Ensuring in object Predef of type [A](x: A)Ensuring[A]
  14.  and method any2ArrowAssoc in object Predef of type [A](x: A)ArrowAssoc[A]
  15.  are possible conversion functions from A.type to ?{def x: ?}
  16.        object A { self: A => println(self.x) }
  17.                                      ^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement