Skip to content

Path dependent type is lost when aliases type parameter and is used in hof #9004

Open
@scabug

Description

@scabug
object Main extends App {
  trait A[RR] { type R <: RR; def r: R }
  def f1(a: A[_]): a.R = a.r
  def f(a: A[_]): Option[a.R] = Some(1).map(_ => a.r)
 
  trait AA[RR] { type R = RR; def r: R }
  def f1(a: AA[_]): a.R = a.r
  def f(a: AA[_]): Option[a.R] = Some(1).map(_ => a.r)
 /**
[error]  found   : Int => Any
[error]  required: Int => a.R
[error]     (which expands to)  Int => _$4
[error]   def f(a: AA[_]): Option[a.R] = Some(1).map(_ => a.r)
**/
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions