Skip to content

Failure in overload resolution with expected result type #2867

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

Closed
szeiger opened this issue Jul 13, 2017 · 0 comments
Closed

Failure in overload resolution with expected result type #2867

szeiger opened this issue Jul 13, 2017 · 0 comments

Comments

@szeiger
Copy link
Contributor

szeiger commented Jul 13, 2017

Discovered in scala/collection-strawman#117 (comment): The following simplified version compiles on Scala 2.13.0-M1 but fails on Dotty master:

  trait Iterable2[A] {
    def flatMap[B](f: A => B): Iterable2[B] = ???
  }
  trait SortedMap2[K, V] extends Iterable2[(K, V)] {
    def flatMap[K2, V2](f: ((K, V)) => (K2, V2))(implicit ordering: Ordering[K2]): SortedMap2[K2, V2] = ???
    def foo: SortedMap2[Int, Int] = flatMap { kv => (0, 0) }
  }

The failure is:

scala>   trait SortedMap2[K, V] extends Iterable2[(K, V)] {
             def flatMap[K2, V2](f: ((K, V)) => (K2, V2))(implicit ordering: Ordering[K2]): SortedMap2[K2, V2] = ???
             def foo: SortedMap2[Int, Int] = flatMap { kv => (0, 0) }
           }
-- [E080] Syntax Error: <console>:7:48 -----------------------------------------
7 |      def foo: SortedMap2[Int, Int] = flatMap { kv => (0, 0) }
  |                                                ^^
  |                     missing parameter type for parameter kv, expected = ?
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