Skip to content

Regression in typelevel/spotted-leopards for extension methods #19950

Closed
@WojciechMazur

Description

@WojciechMazur

Compiler version

Last good release: 3.3.2-RC1-bin-20230623-171849f-NIGHTLY
First bad release: 3.3.2-RC1-bin-20230624-be42772-NIGHTLY
Bisect points to 9ae1598

Minimized code

trait Apply[F[_]]:
  extension [T <: NonEmptyTuple](tuple: T)(using toMap: Tuple.IsMappedBy[F][T])
    def mapN[B](f: Tuple.InverseMap[T, F] => B): F[B] = ???

given Apply[Option] = ???
given Apply[List] = ???
given Apply[util.Try] = ???

@main def Repro = (Option(1), Option(2), Option(3)).mapN(_ + _ + _)

Output

-- [E007] Type Mismatch Error: /Users/wmazur/projects/scala3/bisect/main.scala:10:18 
10 |@main def Repro = (Option(1), Option(2), Option(3)).mapN(_ + _ + _)
   |                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |Found:    (Option[Int], Option[Int], Option[Int])
   |Required: ?{ mapN: ? }
   |Note that implicit extension methods cannot be applied because they are ambiguous;
   |both given instance given_Apply_Option and given instance given_Apply_List provide an extension method `mapN` on (Option[Int], Option[Int], Option[Int])
   |

Expectation

Should compile

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions