Inliner

class Inliner(call: Tree, rhsToInline: Tree)(using `x$3`: Context)

Produces an inlined version of call via its inlined method.

Value Params
call

the original call to an inlineable method

rhsToInline

the body of the inlineable method that replaces the call.

Companion
object
class Object
trait Matchable
class Any

Type members

Classlikes

class InlineTyper(initialErrorCount: Int) extends ReTyper

A typer for inlined bodies. Beyond standard typing, an inline typer performs the following functions:

A typer for inlined bodies. Beyond standard typing, an inline typer performs the following functions:

  1. Implement constant folding over inlined code
  2. Selectively expand ifs with constant conditions
  3. Inline arguments that are by-name closures
  4. Make sure inlined code is type-correct.
  5. Make sure that the tree's typing is idempotent (so that future -Ycheck passes succeed)

Very similar to TreeInfo.isPureExpr, but with the following inliner-only exceptions:

Very similar to TreeInfo.isPureExpr, but with the following inliner-only exceptions:

  • synthetic case class apply methods, when the case class constructor is empty, are elideable but not pure. Elsewhere, accessing the apply method might cause the initialization of a containing object so they are merely idempotent.
object reducer

A utility object offering methods for rewriting inlined code

A utility object offering methods for rewriting inlined code

Value members

Concrete methods

def dropUnusedDefs(bindings: List[MemberDef], tree: Tree)(using Context): (List[MemberDef], Tree)

Drop any side-effect-free bindings that are unused in expansion or other reachable bindings. Inline def bindings that are used only once.

Drop any side-effect-free bindings that are unused in expansion or other reachable bindings. Inline def bindings that are used only once.

def inlined(sourcePos: SrcPos): Tree

The Inlined node representing the inlined call

The Inlined node representing the inlined call

def integrate(tree: Tree, originalOwner: Symbol)(using Context): Tree

Make tree part of inlined expansion. This means its owner has to be changed from its originalOwner, and, if it comes from outside the inlined method itself, it has to be marked as an inlined argument.

Make tree part of inlined expansion. This means its owner has to be changed from its originalOwner, and, if it comes from outside the inlined method itself, it has to be marked as an inlined argument.

def specializeEq(tree: Tree): Tree