Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit conversion does not work for mix-in types #10671

Open
Atry opened this issue Dec 26, 2017 · 0 comments
Open

Implicit conversion does not work for mix-in types #10671

Atry opened this issue Dec 26, 2017 · 0 comments

Comments

@Atry
Copy link

Atry commented Dec 26, 2017

Welcome to Scala 2.12.4 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_152).
Type in expressions for evaluation. Or try :help.

scala> type A = {
     |   def self: Option[String]
     | }
defined type alias A

scala> type B = {
     |   def self: Option[AnyRef]
     | }
defined type alias B

scala> def convert(ab: A with B) = ab.ensuring { _.isInstanceOf[AnyRef] }
<console>:13: error: value ensuring is not a member of A with B
       def convert(ab: A with B) = ab.ensuring { _.isInstanceOf[AnyRef] }
                                      ^

Note that ensuring is an extension method defined in Predef

@Atry Atry changed the title Implicit conversion does not work for mix-in type Implicit conversion does not work for mix-in types Dec 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant