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

Incorrect claim of ambiguity for implicit conversion with implicit view #8857

Closed
scabug opened this issue Sep 21, 2014 · 2 comments
Closed
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Sep 21, 2014

    class Foo
    
    implicit def fromInt[A <% Int](x: A) = new Foo       // #1
    implicit def fromString[A <% String](x: A) = new Foo // #2
    
    0: Foo

gives

error: type mismatch;
 found   : Int(0)
 required: this.Foo
Note that implicit conversions are not applicable because they are ambiguous:
 both method fromInt of type [A](x: A)(implicit evidence$1: A => Int)this.Foo
 and method fromString of type [A](x: A)(implicit evidence$2: A => String)this.Foo
 are possible conversion functions from Int(0) to this.Foo
0: Foo
^

This does not happen 2.11.2.

@scabug
Copy link
Author

scabug commented Sep 21, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8857?orig=1
Reporter: Paul Draper (draperp)
Affected Versions: 2.10.4
Duplicates #3346

@scabug
Copy link
Author

scabug commented Sep 22, 2014

@retronym said:
This works in 2.11 because of the fix for #3346. That's not possible to backport to 2.10.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants