Decorators

dotty.tools.dotc.core.Decorators$
object Decorators

This object provides useful extension methods for types defined elsewhere

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Value members

Concrete fields

inline val MaxFilterRecursions: 10

Extensions

Extensions

extension [T <: AnyRef](arr: Array[T])
def binarySearch(x: T | Null): Int
extension (it: Iterator[Symbol])
final def findSymbol(p: Symbol => Boolean): Symbol

Implements a findSymbol method on iterators of Symbols that works like find but avoids Option, replacing None with NoSymbol.

Implements a findSymbol method on iterators of Symbols that works like find but avoids Option, replacing None with NoSymbol.

Attributes

extension (names: List[String])

Test whether a list of strings representing phases contains a given phase. See config.CompilerCommand#explainAdvanced for the exact meaning of "contains" here.

Test whether a list of strings representing phases contains a given phase. See config.CompilerCommand#explainAdvanced for the exact meaning of "contains" here.

Attributes

extension (pn: PreName)

Extension methods for toType/TermName methods on PreNames.

Extension methods for toType/TermName methods on PreNames.

Attributes

Extension methods for toType/TermName methods on PreNames.

Extension methods for toType/TermName methods on PreNames.

Attributes

extension (s: String)
def concat(name: Name)(using Context): SimpleName
def indented(width: Int): String
def sliceToTermName(start: Int, end: Int)(using Context): SimpleName

Create a term name from a string slice, using a common buffer. This avoids some allocation relative to termName(s)

Create a term name from a string slice, using a common buffer. This avoids some allocation relative to termName(s)

Attributes

def sliceToTypeName(start: Int, end: Int)(using Context): TypeName
def splitWhere(f: Char => Boolean, doDropIndex: Boolean): Option[(String, String)]
extension (sc: StringContext)
def em(args: Shown*)(using Context): NoExplanation

Interpolator yielding an error message, which undergoes the formatting defined in Message.

Interpolator yielding an error message, which undergoes the formatting defined in Message.

Attributes

def i(args: Shown*)(using Context): String

General purpose string formatting

General purpose string formatting

Attributes

extension (str: => String)

Convert lazy string to message. To be with caution, since no message-defined formatting will be done on the string.

Convert lazy string to message. To be with caution, since no message-defined formatting will be done on the string.

Attributes

extension (text: Text)
def show(using Context): String
extension [T](x: T)

Returns the simple class name of x.

Returns the simple class name of x.

Attributes

def showing[U](op: WrappedResult[U] ?=> String, printer: Printer)(using c: Conversion[T, U] | Null): T

Instead of toString call show on Showable values, falling back to toString if an exception is raised.

Instead of toString call show on Showable values, falling back to toString if an exception is raised.

Attributes

extension [T](x: T)
extension [T <: AnyRef](xs: ::[T])
def derivedCons(x1: T, xs1: List[T]): List[T]
extension [T](xs: List[T])
final def eqElements(ys: List[AnyRef]): Boolean

Implements filterConserve, zipWithConserve methods on lists that avoid duplication of list nodes where feasible.

Implements filterConserve, zipWithConserve methods on lists that avoid duplication of list nodes where feasible.

Attributes

def filterConserve(p: T => Boolean): List[T]

Like xs filter p but returns list xs itself - instead of a copy - if p is true for all elements.

Like xs filter p but returns list xs itself - instead of a copy - if p is true for all elements.

Attributes

final def hasSameLengthAs[U](ys: List[U]): Boolean

True if two lists have the same length. Since calling length on linear sequences is Θ(n), it is an inadvisable way to test length equality. This method is Θ(n min m).

True if two lists have the same length. Since calling length on linear sequences is Θ(n), it is an inadvisable way to test length equality. This method is Θ(n min m).

Attributes

def mapWithIndexConserve[U <: T](f: (T, Int) => U): List[U]

Like xs.lazyZip(xs.indices).map(f), but returns list xs itself

Like xs.lazyZip(xs.indices).map(f), but returns list xs itself

  • instead of a copy - if function f maps all elements of xs to themselves.

Attributes

final def mapconserve[U](f: T => U): List[U]

Implements filterConserve, zipWithConserve methods on lists that avoid duplication of list nodes where feasible.

Implements filterConserve, zipWithConserve methods on lists that avoid duplication of list nodes where feasible.

Attributes

def setUnion(ys: List[T]): List[T]

Union on lists seen as sets

Union on lists seen as sets

Attributes

def zipWithConserve[U, V <: T](ys: List[U])(f: (T, U) => V): List[V]

Like xs.lazyZip(ys).map(f), but returns list xs itself

Like xs.lazyZip(ys).map(f), but returns list xs itself

  • instead of a copy - if function f maps all elements of xs to themselves. Also, it is required that ys is at least as long as xs.

Attributes

extension [T, U](xss: List[List[T]])
def nestedMap(f: T => U): List[List[U]]
def nestedMapConserve(f: T => U): List[List[U]]
def nestedZipWithConserve(yss: List[List[U]])(f: (T, U) => T): List[List[T]]