Decorators

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

This object provides useful implicit decorators for types defined elsewhere

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

final implicit class ListDecorator[T](val xs: List[T]) extends AnyVal

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

Graph
Supertypes
class AnyVal
trait Matchable
class Any

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): String

Formatting for error messages: Like i but suppress follow-on error messages after the first one if some of their arguments are "non-sensical".

Formatting for error messages: Like i but suppress follow-on error messages after the first one if some of their arguments are "non-sensical".

Attributes

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

Formatting with added explanations: Like em, but add explanations to give more info about type variables and to disambiguate where needed.

Formatting with added explanations: Like em, but add explanations to give more info about type variables and to disambiguate where needed.

Attributes

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

General purpose string formatting

General purpose string formatting

Attributes

extension (text: Text)
def show(using Context): String
extension [T](x: T)
def assertingErrorsReported(msg: => String)(using Context): T
extension [T](x: T)
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 <: AnyRef](xs: ::[T])
def derivedCons(x1: T, xs1: List[T]): List[T]
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]]

Implicits

Implicits

final implicit def ListDecorator[T](xs: List[T]): ListDecorator[T]

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