Skip to content

Extension method type bound requires explicit parameter #14297

Open
@Adam-Vandervorst

Description

@Adam-Vandervorst

Compiler version

3.1.2-RC1-bin-20220118-9e14f5f-NIGHTLY

Minimized code

trait Applicative[F[_]]

trait Traversable[T[_]] extends Applicative[T]:
  def traverse[F[_] : Applicative, A, B](f: A => F[B]): T[A] => F[T[B]]
  def sequence[F[_] : Applicative, A](tfa: T[F[A]]): F[T[A]] =
    traverse[F , F[A], A](identity)(tfa)

Output

    traverse[F , F[A], A](identity)(tfa)
                                    ^^^
Found:    (tfa : T[F[A]])
Required: extension_implicit_issue.this.Applicative[F]

where:    F is a type in method sequence with bounds <: [_$4] =>> scala.this.Any
          T is a type in trait Traversable with bounds <: [_$2] =>> scala.this.Any

Expectation

Compile, replacing the bounds with implicits does work:

trait Applicative[F[_]]

trait Traversable[T[_]] extends Applicative[T]:
  def traverse[F[_], A, B](f: A => F[B])(using Applicative[F]): T[A] => F[T[B]]
  def sequence[F[_], A](tfa: T[F[A]])(using Applicative[F]): F[T[A]] =
    traverse[F , F[A], A](identity)(tfa)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:desugarDesugaring happens after parsing but before typing, see desugar.scalaitype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions