any

object any
Source:
any.scala
class Object
trait Matchable
class Any
any.type

Type members

Types

type !=[X, Y] <: Boolean

Inequality comparison of two singleton types.

Inequality comparison of two singleton types.

package scala.compiletime.ops
trait Snippet0 { self: any.type =>
  val eq1: 1 != 1 = false
  val eq2: 1 != "1" = true
  val eq3: "1" != "1" = false
}
Source:
any.scala
type ==[X, Y] <: Boolean

Equality comparison of two singleton types.

Equality comparison of two singleton types.

package scala.compiletime.ops
trait Snippet0 { self: any.type =>
  val eq1: 1 == 1 = true
  val eq2: 1 == "1" = false
  val eq3: "1" == "1" = true
}
Source:
any.scala
type IsConst[X] <: Boolean

Tests if a type is a constant.

Tests if a type is a constant.

package scala.compiletime.ops
trait Snippet0 { self: any.type =>
  val c1: IsConst[1] = true
  val c2: IsConst["hi"] = true
  val c3: IsConst[false] = true
  val c4: IsConst[Any] = false
}

If the type is not yet known, then IsConst remains unevaluated, and will be evaluated only at its concrete type application. E.g.:

package scala.compiletime.ops
trait Snippet0 { self: any.type =>
  //def `isConst`` returns the type `IsConst[X]`, since `X` is not yet known.
  def isConst[X] : IsConst[X] = ???
  val c5 : true = isConst[1] //now the type is known to be a constant
  val c6 : false = isConst[Any] //now the type is known to be not a constant
}
Source:
any.scala
type ToString[X] <: String

String conversion of a constant singleton type.

String conversion of a constant singleton type.

package scala.compiletime.ops
trait Snippet0 { self: any.type =>
  val s1: ToString[1] = "1"
  val sTrue: ToString[true] = "true"
}
Source:
any.scala