mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Use workspaces and move everything into compiler/
This commit is contained in:
parent
90e7cf8a15
commit
313b7a79e8
110 changed files with 565 additions and 400 deletions
60
compiler/src/can/problem.rs
Normal file
60
compiler/src/can/problem.rs
Normal file
|
@ -0,0 +1,60 @@
|
|||
use crate::can::pattern::PatternType;
|
||||
use crate::types;
|
||||
use inlinable_string::InlinableString;
|
||||
use roc_module::ident::Ident;
|
||||
use roc_module::symbol::{ModuleId, Symbol};
|
||||
use roc_parse::operator::BinOp;
|
||||
use roc_region::all::{Located, Region};
|
||||
|
||||
/// Problems that can occur in the course of canonicalization.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum Problem {
|
||||
// TODO use Symbol over Ident with these
|
||||
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),
|
||||
ErroneousAnnotation(types::Problem),
|
||||
RuntimeError(RuntimeError),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum PrecedenceProblem {
|
||||
BothNonAssociative(Located<BinOp>, Located<BinOp>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum RuntimeError {
|
||||
Shadowing {
|
||||
original_region: Region,
|
||||
shadow: Located<Ident>,
|
||||
},
|
||||
UnrecognizedFunctionName(Located<InlinableString>),
|
||||
LookupNotInScope(Located<InlinableString>),
|
||||
ValueNotExposed {
|
||||
module_name: InlinableString,
|
||||
ident: InlinableString,
|
||||
region: Region,
|
||||
},
|
||||
ModuleNotImported {
|
||||
module_name: InlinableString,
|
||||
ident: InlinableString,
|
||||
region: Region,
|
||||
},
|
||||
InvalidPrecedence(PrecedenceProblem, Region),
|
||||
FloatOutsideRange(Box<str>),
|
||||
IntOutsideRange(Box<str>),
|
||||
InvalidHex(std::num::ParseIntError, Box<str>),
|
||||
InvalidOctal(std::num::ParseIntError, Box<str>),
|
||||
InvalidBinary(std::num::ParseIntError, Box<str>),
|
||||
QualifiedPatternIdent(InlinableString),
|
||||
CircularDef(
|
||||
Vec<Located<Ident>>,
|
||||
Vec<(Region /* pattern */, Region /* expr */)>,
|
||||
),
|
||||
|
||||
/// When the author specifies a type annotation but no implementation
|
||||
NoImplementation,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue