Skip to content

dotty doesn't seem to take the full context into account when resolving implicits #13974

Closed
@bartosz-witkowski

Description

@bartosz-witkowski

Compiler version

3.1.0 (also tested on latest master 3.1.2-RC1-bin-SNAPSHOT-nonbootstrapped-git-2b37257)

Minimized code

object Test {
  sealed abstract class Use[A]
  case class UseArray[A]() extends Use[Array[A]]

  def go[X](u: Use[X], x: X): Unit = {
    u match {
      case UseArray() =>
        x.size
    }
  }
}

Output

-- [E008] Not Found Error: /home/bartosz/work/programming/scala/scalac/test/src/main/scala/Main.scala:8:10 
8 |        x.size
  |        ^^^^^^
  |        value size is not a member of X
  |
  |        where:    X is a type in method go which is an alias of Array[A$1]

Expectation

Code compiles without errors.

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