Struct kailua_types::ty::SpannedTySeq
[−]
[src]
pub struct SpannedTySeq { pub head: Vec<Spanned<Ty>>, pub tail: Option<Spanned<Ty>>, pub span: Span, }
A sequence of spanned value types. The sequence itself also contains its span.
Fields
head: Vec<Spanned<Ty>>
The "head" types, a list of finite types at the beginning of the sequence.
tail: Option<Spanned<Ty>>
The optional "tail" type. If present, it repeats indefinitely after "head".
This is implicitly nilable, because the actual value represented by the sequence
is never infinite, so there should be a nil
somewhere.
Since we don't know where it ends,
the tail should be implicitly unioned with nil
in all practical sense.
We may implicitly put the nil
here if it's missing,
but the absence of the tail type makes a few important differences in checking.
For example, function arguments are a sequence,
and excess parameters to non-variadic arguments should be forbidden
even if those excess parameters are always nil
.
This is only possible when we have a separate way to mark a missing tail.
span: Span
A span of the entire sequence. Used for finer diagnostics.
Methods
impl SpannedTySeq
[src]
fn new(span: Span) -> SpannedTySeq
fn from_kind_seq<T, F: for<'a> Fn(&'a T) -> &'a Spanned<Kind>>(
seq: &Seq<T, Spanned<Kind>>,
map: F,
resolv: &mut TypeResolver,
span: Span
) -> Result<SpannedTySeq>
seq: &Seq<T, Spanned<Kind>>,
map: F,
resolv: &mut TypeResolver,
span: Span
) -> Result<SpannedTySeq>
fn dummy() -> SpannedTySeq
fn ensure_at(&mut self, i: usize) -> &Spanned<Ty>
fn ensure_at_mut(&mut self, i: usize) -> &mut Spanned<Ty>
fn ensure_tail(self) -> Self
fn into_iter(self) -> SeqIter<Spanned<Ty>>
fn into_iter_with_none(
self
) -> Chain<Map<SeqIter<Spanned<Ty>>, fn(_: Spanned<Ty>) -> Option<Spanned<Ty>>>, Repeat<Option<Spanned<Ty>>>>
self
) -> Chain<Map<SeqIter<Spanned<Ty>>, fn(_: Spanned<Ty>) -> Option<Spanned<Ty>>>, Repeat<Option<Spanned<Ty>>>>
fn into_iter_with_nil(self) -> Chain<SeqIter<Spanned<Ty>>, Repeat<Spanned<Ty>>>
fn into_first(self) -> Spanned<Ty>
impl SpannedTySeq
[src]
fn unspan(self) -> TySeq
fn all_span(&self) -> Span
fn all_with_loc<Loc: Into<Span>>(self, loc: Loc) -> SpannedTySeq
fn all_without_loc(self) -> SpannedTySeq
Trait Implementations
impl Clone for SpannedTySeq
[src]
fn clone(&self) -> SpannedTySeq
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for SpannedTySeq
[src]
fn eq(&self, __arg_0: &SpannedTySeq) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &SpannedTySeq) -> bool
This method tests for !=
.
impl<'a> From<Spanned<T<'a>>> for SpannedTySeq
[src]
fn from(t: Spanned<T<'a>>) -> SpannedTySeq
Performs the conversion.
impl From<Spanned<Ty>> for SpannedTySeq
[src]
fn from(t: Spanned<Ty>) -> SpannedTySeq
Performs the conversion.
impl Dummy for SpannedTySeq
[src]
fn dummy() -> SpannedTySeq
Generates a dummy value.
impl Union for SpannedTySeq
[src]
type Output = SpannedTySeq
A type of the resulting type.
fn union(
&self,
other: &SpannedTySeq,
explicit: bool,
ctx: &mut TypeContext
) -> TypeResult<SpannedTySeq>
&self,
other: &SpannedTySeq,
explicit: bool,
ctx: &mut TypeContext
) -> TypeResult<SpannedTySeq>
Calculates a union type of self
and other
, explicitly or implicitly. Read more
impl Lattice for SpannedTySeq
[src]
fn assert_sub(
&self,
other: &SpannedTySeq,
ctx: &mut TypeContext
) -> TypeResult<()>
&self,
other: &SpannedTySeq,
ctx: &mut TypeContext
) -> TypeResult<()>
Asserts that self
is a consistent subtype of other
under the type context.
fn assert_eq(
&self,
other: &SpannedTySeq,
ctx: &mut TypeContext
) -> TypeResult<()>
&self,
other: &SpannedTySeq,
ctx: &mut TypeContext
) -> TypeResult<()>
Asserts that self
is a consistent type equal to other
under the type context.