pub enum TyKind {
Struct(Struct),
Float(FloatTy),
Int(IntTy),
Bool,
Tuple(usize, Substitution),
InferenceVar(InferTy),
TypeAlias(TypeAlias),
Never,
FnDef(CallableDef, Substitution),
Array(Ty),
Unknown,
}
Expand description
A kind of type.
Variants§
Struct(Struct)
An abstract datatype (structures, tuples, or enumerations) TODO: Add enumerations
Float(FloatTy)
The primitive floating point type. Written as float
.
Int(IntTy)
The primitive integral type. Written as int
.
Bool
The primitive boolean type. Written as bool
.
Tuple(usize, Substitution)
A tuple type. For example (f32, f64, bool)
.
InferenceVar(InferTy)
A type variable used during type checking. Not to be confused with a type parameter.
TypeAlias(TypeAlias)
A type alias
Never
The never type never
.
FnDef(CallableDef, Substitution)
The anonymous type of a function declaration/definition. Each function has a unique type,
which is output (for a function named foo
returning an number
) as
fn() -> number {foo}
.
This includes tuple struct / enum variant constructors as well.
For example the type of bar
here:
function foo() -> number { 1 }
let bar = foo; // bar: function() -> number {foo}
Array(Ty)
An dynamically sized array type
Unknown
A placeholder for a type which could not be computed; this is propagated to avoid useless error messages. Doubles as a placeholder where type variables are inserted before type checking, since we want to try to infer a better type here anyway – for the IDE use case, we want to try to infer as much as possible even in the presence of type errors.
Implementations§
Trait Implementations§
source§impl HasVisibility for TyKind
impl HasVisibility for TyKind
fn visibility(&self, db: &dyn HirDatabase) -> Visibility
impl Eq for TyKind
impl StructuralEq for TyKind
impl StructuralPartialEq for TyKind
Auto Trait Implementations§
impl RefUnwindSafe for TyKind
impl Send for TyKind
impl Sync for TyKind
impl Unpin for TyKind
impl UnwindSafe for TyKind
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.