Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-9943

Wrong expected argument type for overloaded higher-order method

    Details

      Description

      The following codes cannot be compiled with 2.12.0-RC1

      class Foo[T] {
        def toMap[K, V](implicit ev: Foo[T] <:< Foo[(K, V)]): Foo[Map[K, V]] = null
        def toMap[K](keySelector: T => K): Foo[Map[K, T]] = null
      }
       
      object Foo {
        val f: Foo[Int] = null
        val m = f.toMap(_ % 2)
      }
      

      The error information is:

      value % is not a member of Any
      [error]   val m = f.toMap(_ % 2)
      [error]                     ^
      [error] one error found
      

      It works with 2.12.0-M5, 2.11 and 2.10.

      Is it a regression in 2.12.0-RC1?

        Attachments

          Activity

            People

            • Assignee:
              moors Adriaan Moors
              Reporter:
              zsxwing Shixiong Zhu
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: