Update language server to support apps

This commit is contained in:
Ayaz Hafiz 2022-11-20 12:18:40 -06:00
parent b706a57e16
commit 6e89821233
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
7 changed files with 92 additions and 16 deletions

View file

@ -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,