mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +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
|
@ -2687,6 +2687,14 @@ fn update<'a>(
|
|||
.typechecked
|
||||
.insert(module_id, typechecked);
|
||||
} else {
|
||||
state.module_cache.checked.insert(
|
||||
module_id,
|
||||
CheckedModule {
|
||||
solved_subs,
|
||||
decls,
|
||||
abilities_store,
|
||||
},
|
||||
);
|
||||
state.constrained_ident_ids.insert(module_id, ident_ids);
|
||||
state.timings.insert(module_id, module_timing);
|
||||
}
|
||||
|
@ -3321,7 +3329,8 @@ fn finish(
|
|||
solved,
|
||||
can_problems: state.module_cache.can_problems,
|
||||
type_problems: state.module_cache.type_problems,
|
||||
declarations_by_id: state.declarations_by_id,
|
||||
declarations_by_id,
|
||||
typechecked: state.module_cache.checked,
|
||||
dep_idents,
|
||||
exposed_aliases: exposed_aliases_by_symbol,
|
||||
exposed_values,
|
||||
|
|
|
@ -667,7 +667,7 @@ fn solve(
|
|||
}
|
||||
}
|
||||
None => {
|
||||
problems.push(TypeError::UnexposedLookup(*symbol));
|
||||
problems.push(TypeError::UnexposedLookup(*region, *symbol));
|
||||
|
||||
state
|
||||
}
|
||||
|
|
|
@ -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