pub enum TypeAtom {
Cmd {
list: ListGroup<()>,
args: Vec<TypeCmdArgItem>,
kind: CmdTypeKind,
},
Paren {
paren: ParenGroup<()>,
inner: TyErased,
},
Record {
rec: RecordGroup<()>,
fields: Vec<TypeRecordField>,
},
Var(TypeVarTok),
Name(VarTok),
NameMod(VarWithModTok),
RecordOpen {
orec: RecordGroup<()>,
inner: CstRecordOpenInner,
},
}Expand description
An atomic type expression.
Variants§
Cmd
[ty; ty?; ..] inline-cmd / block-cmd / math-cmd
(parser.mly’s txapppre command-type productions, 903-919) —
tried first: unambiguous, since no other TypeAtom starts with
[ (BListTok). Each ;-separated element is a TypeCmdArgItem.
Paren
( ty )
Record
(| l1 : ty1; l2 : ty2; … |) — a closed record type (txbot’s
txrecord case, parser.mly:955-961), lowered to
MonoType::Record (a Row::Cons chain ending in Row::Empty —
see typecheck.rs’s lower_type_atom). Distinguished from
TypeAtom::Paren (opens on plain LParenTok, i.e. () and
from a record-VALUE expression (Atomic::Record, a different
grammar position — only reachable where an Expr is expected,
never in type position) purely by lexer-level delimiter token:
(|/|) lex as the dedicated BRecordTok/ERecordTok pair
(same as super::RecordKind’s use at constraint 'a :: (|…|)), so no
backtracking between any of these three shapes is needed.
Var(TypeVarTok)
A type variable, e.g. 'a.
Name(VarTok)
An unqualified type name, e.g. int, string.
NameMod(VarWithModTok)
Mod.t — a bare module-qualified type name in atomic (0-ary,
non-applied) position, e.g. Eq.t in val eq : Eq.t -> Eq.t -> ordering. Sibling of Name (not a widened
field on it); as the last atom of a TypeApp it is a
module-qualified type constructor (int M.t, ordering Eq.t).
Tried after Name only by placement convention (the two are
token-disjoint: VarTok/VarWithModTok are separate lexer
tokens, so there is no real backtracking ambiguity between them).
RecordOpen
(| l1 : ty1, … | ?'r |) — a SATySFi 0.1 OPEN record type: a
row-variable tail after the fields (upstream typ_bot’s SECOND
L_RECORD/R_RECORD production, parser_v1.mly:748-749).
Lowered (typecheck.rs) to
MonoType::Record(Row::Cons(l1, ty1, … Row::Var(fresh))) — the
row variable unifies structurally as an open record’s tail
(permitting additional fields at the unification site), reusing
the existing generic Row/RowVarRef/unify_row machinery — no
new type machinery needed. Genuinely a NEW shape, not a widening
of the frozen TypeAtom::Record (0.0.6’s txrecord grammar has
no row-var tail at all, confirmed by grep of upstream
parser.mly). Comma-separated fields, matching this file’s 0.1
additive
nodes (CstOptArgEntry, CstOptBinderEntry) rather than the
frozen Record’s upstream-0.0.6 ; separator. Unreachable from a
V0_0 token stream by construction: RowVarTok is only ever
emitted by the lexer under [crate::version::RustyfiVersion:: V0_1] (lexer.rs’s '?' arm), so no 0.0.6 parse can ever
produce this variant — no elaborate/typecheck-time version gate
is needed here (contrast TypeExpr::OptRowFun, which IS
reachable from 0.0.6 lexing and so DOES need one).
Trait Implementations§
Source§impl<__SyanMacro_Atom> Parse<__SyanMacro_Atom> for TypeAtomwhere
__SyanMacro_Atom: Spanned + Clone,
ListGroup<()>: GroupShape<__SyanMacro_Atom>,
__SyanSubstructOfOwn_list_TypeAtom_Cmd_13316143612193599257: Parse<__SyanMacro_Atom>,
CmdTypeKind: Parse<__SyanMacro_Atom>,
ParenGroup<()>: GroupShape<__SyanMacro_Atom>,
__SyanSubstructOfOwn_paren_TypeAtom_Paren_13316143612193599257: Parse<__SyanMacro_Atom>,
RecordGroup<()>: GroupShape<__SyanMacro_Atom>,
__SyanSubstructOfOwn_rec_TypeAtom_Record_13316143612193599257: Parse<__SyanMacro_Atom>,
TypeVarTok: Parse<__SyanMacro_Atom>,
VarTok: Parse<__SyanMacro_Atom>,
VarWithModTok: Parse<__SyanMacro_Atom>,
__SyanSubstructOfOwn_orec_TypeAtom_RecordOpen_13316143612193599257: Parse<__SyanMacro_Atom>,
impl<__SyanMacro_Atom> Parse<__SyanMacro_Atom> for TypeAtomwhere
__SyanMacro_Atom: Spanned + Clone,
ListGroup<()>: GroupShape<__SyanMacro_Atom>,
__SyanSubstructOfOwn_list_TypeAtom_Cmd_13316143612193599257: Parse<__SyanMacro_Atom>,
CmdTypeKind: Parse<__SyanMacro_Atom>,
ParenGroup<()>: GroupShape<__SyanMacro_Atom>,
__SyanSubstructOfOwn_paren_TypeAtom_Paren_13316143612193599257: Parse<__SyanMacro_Atom>,
RecordGroup<()>: GroupShape<__SyanMacro_Atom>,
__SyanSubstructOfOwn_rec_TypeAtom_Record_13316143612193599257: Parse<__SyanMacro_Atom>,
TypeVarTok: Parse<__SyanMacro_Atom>,
VarTok: Parse<__SyanMacro_Atom>,
VarWithModTok: Parse<__SyanMacro_Atom>,
__SyanSubstructOfOwn_orec_TypeAtom_RecordOpen_13316143612193599257: Parse<__SyanMacro_Atom>,
Source§type Error = ParseError<<__SyanMacro_Atom as Spanned>::Span>
type Error = ParseError<<__SyanMacro_Atom as Spanned>::Span>
<FieldTy as Parse<Atom>>::Error: Into<…> predicate re-creates a projection cycle on a
recursive field (E0275), which decycle’s bound-peeling does not break.