Skip to content

Implicits not forwarded correctly in trait parameters #11966

Closed
@rjolly

Description

@rjolly

Compiler version

3.0.0-RC2

Minimized code and output

trait A[T]:
  def f: T

trait B[T: A]:
  println(summon[A[T]].f)

trait C[T: A] extends B[T]

given A[Int] with
  def f = 1

class D extends C[Int]:
  given A[Int] with
    def f = 2

new D
// 2

Expectation : the compiler should not be distracted by the inner given:

class D extends C[Int]:
//given A[Int] with
//  def f = 2

new D
// 1

Note that the problem does not occur when extending B directly:

class D extends B[Int]:
  given A[Int] with
    def f = 2

new D
// 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions