pub enum InvalidVariantKind {
LowercaseName(Name),
Tuple,
Unit,
Arrow,
Record,
}Expand description
What was written where a type declaration expected a variant — see
Error::InvalidVariant.
A variant is a constructor name followed by zero or more type arguments, and
nothing else. The grammar does not enforce that: it parses a variant list with
the general Type production, so every shape a type expression can take reaches
do_types. This enum names the five that are not a variant, one per remaining
[parser::TypeKind], so each can say what it is in the words of the source.
Variants§
LowercaseName(Name)
A name beginning with a lowercase letter, which the grammar reads as a type
variable — type Colour = red, and a mistyped constructor name along with
it. Carries the name so the message can quote it.
Tuple
A tuple type — type Pair = (Int, Int).
Unit
The unit type — type Nothing = ().
Arrow
A function type — type Wrapper = Wrap Int -> Int. The arrow is the whole
variant rather than a suffix of it, Wrap Int being its left operand, so
there is no constructor here to keep either.
Record
A record type — type Point = { x : Int }. A record type is declared by no
type declaration; one may sit inside a variant, Point { x : Int }.
Trait Implementations§
Source§impl Clone for InvalidVariantKind
impl Clone for InvalidVariantKind
Source§fn clone(&self) -> InvalidVariantKind
fn clone(&self) -> InvalidVariantKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more