Decorators

object Decorators

This object provides useful implicit decorators for types defined elsewhere

class Object
trait Matchable
class Any

Type members

Classlikes

final 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.

Value members

Concrete fields

final val MaxFilterRecursions: 10

Extensions

Extensions

extension (arr: Array[T])
def binarySearch[T <: AnyRef](x: T): 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.

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.

extension (pn: PreName)

Extension methods for toType/TermName methods on strings. They are in an implicit object for now, so that we can import decorators with a normal wildcard. In the future, once #9255 is in trunk, replace with a simple collective extension.

Extension methods for toType/TermName methods on strings. They are in an implicit object for now, so that we can import decorators with a normal wildcard. In the future, once #9255 is in trunk, replace with a simple collective extension.

Extension methods for toType/TermName methods on strings. They are in an implicit object for now, so that we can import decorators with a normal wildcard. In the future, once #9255 is in trunk, replace with a simple collective extension.

Extension methods for toType/TermName methods on strings. They are in an implicit object for now, so that we can import decorators with a normal wildcard. In the future, once #9255 is in trunk, replace with a simple collective extension.

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)

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: Any*)(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".

def ex(args: Any*)(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.

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

General purpose string formatting

General purpose string formatting

extension (text: Text)
def show(using Context): String
extension (x: T)
def assertingErrorsReported[T](msg: => String)(using Context): T
extension (x: T)
def showing[T](op: WrappedResult[T] => String, printer: Printer): T
extension (xs: ::[T])
def derivedCons[T <: AnyRef](x1: T, xs1: List[T]): List[T]
extension (xss: List[List[T]])
def nestedExists[T, U](p: T => Boolean): Boolean
def nestedMap[T, U](f: T => U): List[List[U]]
def nestedMapConserve[T, U](f: T => U): List[List[U]]
def nestedZipWithConserve[T, U](yss: List[List[U]])(f: (T, U) => T): List[List[T]]