Skip to content

Compiler fails to inline #3488

Closed
Closed
@allanrenucci

Description

@allanrenucci

The following code snippet does not compile with Dotty:

class Set[A] {

  def incl(elem: A): Set[A] = ???

  inline final def + (elem: A): Set[A] = incl(elem)
}

object Set {
  def apply[A](elems: A*): Set[A] = ???
}

class Test {
  Set(1) + 1
}
-- Error: tests/allan/Test.scala:13:9 ------------------------------------------
13 |  Set(1) + 1
   |  ^^^^^^^^^^
   |undefined: Set_this.incl # 191: TermRef(TermRef(NoPrefix,val Set_this),incl[with sig Signature(List(java.lang.Object),Set)])

It compiles without the inline keyword.

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