use inlinable_string::InlinableString; 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), UnusedArgument(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(Located, Located), } #[derive(Clone, Debug, PartialEq)] pub enum RuntimeError { Shadowing { original_region: Region, shadow: Located, }, UnrecognizedFunctionName(Located), LookupNotInScope(Located), ValueNotExposed { module_name: InlinableString, ident: InlinableString, region: Region, }, ModuleNotImported { module_name: InlinableString, ident: InlinableString, region: Region, }, InvalidPrecedence(PrecedenceProblem, 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, }