mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Update language server to support apps
This commit is contained in:
parent
b706a57e16
commit
6e89821233
7 changed files with 92 additions and 16 deletions
|
@ -14,7 +14,7 @@ pub enum TypeError {
|
|||
BadPattern(Region, PatternCategory, ErrorType, PExpected<ErrorType>),
|
||||
CircularType(Region, Symbol, ErrorType),
|
||||
CircularDef(Vec<CycleEntry>),
|
||||
UnexposedLookup(Symbol),
|
||||
UnexposedLookup(Region, Symbol),
|
||||
UnfulfilledAbility(Unfulfilled),
|
||||
BadExprMissingAbility(Region, Category, ErrorType, Vec<Unfulfilled>),
|
||||
BadPatternMissingAbility(Region, PatternCategory, ErrorType, Vec<Unfulfilled>),
|
||||
|
@ -58,7 +58,19 @@ impl TypeError {
|
|||
}
|
||||
|
||||
pub fn region(&self) -> Option<Region> {
|
||||
Some(Region::zero())
|
||||
match self {
|
||||
TypeError::BadExpr(region, ..)
|
||||
| TypeError::BadPattern(region, ..)
|
||||
| TypeError::CircularType(region, ..)
|
||||
| TypeError::UnexposedLookup(region, ..)
|
||||
| TypeError::BadExprMissingAbility(region, ..)
|
||||
| TypeError::StructuralSpecialization { region, .. }
|
||||
| TypeError::WrongSpecialization { region, .. }
|
||||
| TypeError::BadPatternMissingAbility(region, ..) => Some(*region),
|
||||
TypeError::UnfulfilledAbility(ab, ..) => ab.region(),
|
||||
TypeError::Exhaustive(e) => Some(e.region()),
|
||||
TypeError::CircularDef(c) => c.first().map(|ce| ce.symbol_region),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,6 +94,16 @@ pub enum Unfulfilled {
|
|||
},
|
||||
}
|
||||
|
||||
impl Unfulfilled {
|
||||
fn region(&self) -> Option<Region> {
|
||||
match self {
|
||||
Unfulfilled::OpaqueDoesNotImplement { .. } => None,
|
||||
Unfulfilled::AdhocUnderivable { .. } => None,
|
||||
Unfulfilled::OpaqueUnderivable { derive_region, .. } => Some(*derive_region),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Debug, Clone)]
|
||||
pub enum UnderivableReason {
|
||||
NotABuiltin,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue