Skip to content

Type member selection on argument of type Nothing fails #11864

@japgolly

Description

@japgolly

Compiler version

3.0.0-RC1 with -Ykind-projector -Yerased-terms

Minimized code

final class CallbackTo[+A] {
  inline def map[B](f: A => B)(using erased ev: CallbackTo.MapGuard[B]): CallbackTo[ev.Out] = ???
}

object CallbackTo {

  type MapGuard[A] = { type Out = A }
  erased given MapGuard[A]: MapGuard[A] = ???

  def traverse[A, B](ta: List[A]): CallbackTo[List[B]] =
    val x: CallbackTo[List[A] => List[B]] = ???
    x.map(_(ta))
}

Output

12 |    x.map(_(ta))
   |    ^^^^^^^^^^^^
   |Out cannot be accessed as a member of (ev$proxy1 : Nothing) from module class CallbackTo$.
   | This location contains code that was inlined from x.scala:2
1 error found

Expectation

It should compile.

The problem occurs due to the combination of inline and erased because either of the following work as workarounds:

  • Removing inline from .map
  • Changing MapGuard to not be erased

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions