Skip to content

GADT contraint not considered for given/extension in implicit scope #24638

@eejbyfeldt

Description

@eejbyfeldt

Compiler version

3.7.4, 3.8.1-RC1-bin-20251203-b2850be-NIGHTL

Minimized code

$ cat gadt_contraint_implicit.scala
trait Expr[T]
object Expr {
  extension (lhs: Expr[Boolean])
    infix def ||(rhs: Expr[Boolean]): Expr[Boolean] = ???
}

object test {
  sealed trait A[T]
  object Or extends A[Boolean]

  def g[T](a: A[T], lhs: Expr[T]): Expr[T] = 
    a match {
    case Or => lhs || lhs
  }
}

Output

[error] ./gadt_contraint_implicit.scala:13:16
[error] value || is not a member of Expr[T]
[error] 
[error] where:    T is a type in method g which is an alias of Boolean
[error]     case Or => lhs || lhs
[error]   

Expectation

The code some compile.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions