Unit

@compileTimeOnly("`Unit` companion object is not allowed in source; instead, use `()` for the unit value") object Unit extends AnyValCompanion
Companion
class
Source
Unit.scala
class Object
trait Matchable
class Any

Value members

Concrete methods

def box(x: Unit): BoxedUnit

Transform a value type into a boxed reference type.

Transform a value type into a boxed reference type.

This method is not intended for use in source code. The runtime representation of this value is platform specific.

Value Params
x

the Unit to be boxed

Returns

a scala.runtime.BoxedUnit offering x as its underlying value.

Source
Unit.scala
override def toString: String

The String representation of the scala.Unit companion object.

The String representation of the scala.Unit companion object.

Definition Classes
Any
Source
Unit.scala
def unbox(x: Object): Unit

Transform a boxed type into a value type.

Transform a boxed type into a value type. Note that this method is not typesafe: it accepts any Object, but will throw an exception if the argument is not a scala.runtime.BoxedUnit.

This method is not intended for use in source code. The result of successfully unboxing a value is ().

Value Params
x

the scala.runtime.BoxedUnit to be unboxed.

Returns

the Unit value ()

Throws
ClassCastException

if the argument is not a scala.runtime.BoxedUnit

Source
Unit.scala