pub struct RecBinding {
pub name: BindName,
pub ascription: Option<RecAscription>,
pub leading_bar: Option<BarTok>,
pub params: Vec<PatBot>,
pub eq: DefEqTok,
pub value: ExprErased,
pub extra: Vec<RecClause>,
}Expand description
One name [: ty] [|] patbot* = value [| patbot* = value]* clause
GROUP of a let-rec (also reused, from outside this module, by
top-level let-rec). ascription is parser.mly’s rarer
COLON ty type-annotated form (recdecargpart’s COLON ty BAR
alternative), e.g. the bundled itemize.satyh’s let-rec listing-item : context -> int -> bool -> bool -> itemize -> block-boxes | ctx depth is-first is-last (Item(...)) = ... Parsed
but not enforced — there is no enforcement pass for value-level
ascriptions (only module val/direct signature items reach
typecheck.rs’s command_scheme/sig machinery) — so it is a
parse-and-ignore stand-in whose only job is making verbatim upstream
source parse. params is
patbot* (recdecargpart’s plain argpats form, optionally
preceded by a leading_bar — recdecargpart’s BAR argpatlst
alternative, used both for the OCaml-style “every clause, including
the first, gets a |” layout the bundled packages write, e.g.
list.satyg’s let-rec map\n | f [] = []\n | f (x :: xs) = ..,
and for the COLON ty BAR form above, whose single clause is only
reachable via a leading |). extra holds any further
| patbot* = value continuation clauses (nxrecdecpar) — SATySFi’s
multi-clause pattern-matching function-definition sugar. Every
clause in the group must bind the same number of parameters (checked
at elaboration — upstream’s IllegalArgumentLength — not here); the
(possibly plural) clauses desugar to one curried function that
matches a tuple of fresh parameters against each clause’s patterns
in turn — see elaborate.rs’s rec_clause_value.
Fields§
§name: BindName§ascription: Option<RecAscription>§leading_bar: Option<BarTok>§params: Vec<PatBot>§eq: DefEqTok§value: ExprErased§extra: Vec<RecClause>Trait Implementations§
Source§impl Clone for RecBinding
impl Clone for RecBinding
Source§fn clone(&self) -> RecBinding
fn clone(&self) -> RecBinding
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RecBinding
impl Debug for RecBinding
Source§impl<__SyanMacro_Atom> Parse<__SyanMacro_Atom> for RecBindingwhere
__SyanMacro_Atom: Spanned + Clone,
BindName: Parse<__SyanMacro_Atom>,
Option<RecAscription>: Parse<__SyanMacro_Atom>,
Option<BarTok>: Parse<__SyanMacro_Atom>,
Vec<PatBot>: Parse<__SyanMacro_Atom>,
DefEqTok: Parse<__SyanMacro_Atom>,
ExprErased: Parse<__SyanMacro_Atom>,
Vec<RecClause>: Parse<__SyanMacro_Atom>,
impl<__SyanMacro_Atom> Parse<__SyanMacro_Atom> for RecBindingwhere
__SyanMacro_Atom: Spanned + Clone,
BindName: Parse<__SyanMacro_Atom>,
Option<RecAscription>: Parse<__SyanMacro_Atom>,
Option<BarTok>: Parse<__SyanMacro_Atom>,
Vec<PatBot>: Parse<__SyanMacro_Atom>,
DefEqTok: Parse<__SyanMacro_Atom>,
ExprErased: Parse<__SyanMacro_Atom>,
Vec<RecClause>: 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.