Class/Object

com.avsystem.commons.misc

TypeString

Related Docs: object TypeString | package misc

Permalink

final class TypeString[T] extends AnyVal

Typeclass that contains string representation of a concrete type. This representation should correctly parse and typecheck when used as a type in Scala source code.

Instances of TypeString are implicitly macro-materialized. The macro will fail if the type contains references to local symbols, i.e. symbols that only exist in limited scope and cannot be referred to from any place in source code. This includes type parameters, this-references to enclosing classes, etc.

For example, the code below will NOT compile:

def listTypeRepr[T]: String = TypeString.of[List[T]]

because T is a local symbol that only has meaning inside its own method. However, if you provide external TypeString instance for T, the macro will pick it up and no longer complain:

def listTypeRepr[T: TypeString]: String = TypeString.of[List[T]]

Then, listTypeRepr[Int] will produce a string "List[Int]"

Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TypeString
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TypeString(value: String)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def getClass(): Class[_ <: AnyVal]

    Permalink
    Definition Classes
    AnyVal → Any
  6. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  7. def toString(): String

    Permalink
    Definition Classes
    TypeString → Any
  8. val value: String

    Permalink

Inherited from AnyVal

Inherited from Any

Ungrouped