Enum kailua_types::ty::T [] [src]

pub enum T<'a> {
    Dynamic(Dyn),
    All,
    None,
    Boolean,
    True,
    False,
    Integer,
    Number,
    String,
    Thread,
    UserData,
    Int(i32),
    Str(Cow<'a, Str>),
    Tables(Cow<'a, Tables>),
    Functions(Cow<'a, Functions>),
    Class(Class),
    TVar(TVar),
    Union(Cow<'a, Unioned>),
}

A value type, except for nil which is specially treated.

Unions are also special in that they can be generated only from the type specification. Also, literal types in T are "implicit" in that they will be converted to supertypes when being assigned (otherwise it would be very cumbersome to use); the type specification generates unions for literal types (even when there is only one item), so explicitly written literal types are retained on assignment.

Variants

Dynamic type.

any (the top type).

A bottom type.

This is not equivalent to a diverging type (only allowed in return types) because in Kailua T, T! and T? can be almost freely mixed. Consequently, this represents either a silent nil (nil), a noisy nil (nil?) or a type that can be used in any way except for the conversion (nil!).

boolean.

true generated from an implicit Lua expression.

false generated from an implicit Lua expression.

integer.

number.

string.

thread.

userdata.

An integer literal type generated from an implicit Lua expression.

A string literal type generated from an implicit Lua expression.

Table types.

Function types.

Nominal types.

A type variable.

Union types, or explicit literal types.

Methods

impl<'a> T<'a>
[src]

Coerces "implicit" types into "explicit" types.

This is the only possible way in Kailua for implicit coercions to happen, and does the following:

  • Removes implicit literal types from self, by replacing them with boolean, integer or string. This does not affect explicit literal types from Ty::from_kind. (This happens in the shallow way, as implicit types are incrementally constructed.)

This is used when new variable or field has been added without explicit types, or upper & exact bounds for type variables get updated (lower bounds do not).

Replaces type and row variables present in given type to their fresh copies.

Primarily used for function calls where all type variable and row variables are made fresh per each call, so that prior calls cannot affect constraints to later calls.

Trait Implementations

impl<'a> Clone for T<'a>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> Dummy for T<'a>
[src]

Generates a dummy value.

impl<'a> Union<Unioned> for T<'a>
[src]

A type of the resulting type.

Calculates a union type of self and other, explicitly or implicitly. Read more

impl<'a> Lattice<Unioned> for T<'a>
[src]

Asserts that self is a consistent subtype of other under the type context.

Asserts that self is a consistent type equal to other under the type context.

impl<'a, 'b> Lattice<T<'b>> for T<'a>
[src]

Asserts that self is a consistent subtype of other under the type context.

Asserts that self is a consistent type equal to other under the type context.

impl<'a, 'b> BitOr<T<'b>> for T<'a>
[src]

The resulting type after applying the | operator

The method for the | operator

impl<'a, 'b> PartialEq<T<'b>> for T<'a>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'a> Display for T<'a>
[src]

impl<'a> Debug for T<'a>
[src]

Formats the value using the given formatter.

impl<'a> Union<Ty> for T<'a>
[src]

A type of the resulting type.

Calculates a union type of self and other, explicitly or implicitly. Read more

impl<'a> Lattice<Ty> for T<'a>
[src]

Asserts that self is a consistent subtype of other under the type context.

Asserts that self is a consistent type equal to other under the type context.