use inlinable_string::InlinableString; use roc_collections::all::MutSet; use roc_module::ident::Ident; use roc_module::symbol::{ModuleId, Symbol}; use roc_parse::operator::BinOp; use roc_parse::pattern::PatternType; use roc_region::all::{Located, Region}; /// Problems that can occur in the course of canonicalization. #[derive(Clone, Debug, PartialEq)] pub enum Problem { UnusedDef(Symbol, Region), UnusedImport(ModuleId, Region), /// First symbol is the name of the closure with that argument /// Second symbol is the name of the argument that is unused UnusedArgument(Symbol, Symbol, Region), PrecedenceProblem(PrecedenceProblem), // Example: (5 = 1 + 2) is an unsupported pattern in an assignment; Int patterns aren't allowed in assignments! UnsupportedPattern(PatternType, Region), ShadowingInAnnotation { original_region: Region, shadow: Located, }, RuntimeError(RuntimeError), } #[derive(Clone, Debug, PartialEq)] pub enum PrecedenceProblem { BothNonAssociative(Region, Located, Located), } #[derive(Clone, Debug, PartialEq)] pub enum RuntimeError { Shadowing { original_region: Region, shadow: Located, }, // Example: (5 = 1 + 2) is an unsupported pattern in an assignment; Int patterns aren't allowed in assignments! UnsupportedPattern(Region), UnrecognizedFunctionName(Located), LookupNotInScope(Located, MutSet>), ValueNotExposed { module_name: InlinableString, ident: InlinableString, region: Region, }, ModuleNotImported { module_name: InlinableString, ident: InlinableString, region: Region, }, InvalidPrecedence(PrecedenceProblem, Region), MalformedIdentifier(Box, Region), MalformedClosure(Region), FloatOutsideRange(Box), IntOutsideRange(Box), InvalidHex(std::num::ParseIntError, Box), InvalidOctal(std::num::ParseIntError, Box), InvalidBinary(std::num::ParseIntError, Box), QualifiedPatternIdent(InlinableString), CircularDef( Vec>, Vec<(Region /* pattern */, Region /* expr */)>, ), /// When the author specifies a type annotation but no implementation NoImplementation, }