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]"
- Alphabetic
- By Inheritance
- TypeString
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new TypeString(value: String)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
toString(): String
- Definition Classes
- TypeString → Any
- val value: String