Skip to content

Commit

Permalink
Merge pull request #972 from sbillig/parser-recovery-rework
Browse files Browse the repository at this point in the history
Parser recovery rework
  • Loading branch information
sbillig authored Apr 12, 2024
2 parents 65f3804 + 273ce09 commit 57335f1
Show file tree
Hide file tree
Showing 101 changed files with 3,574 additions and 3,106 deletions.
102 changes: 55 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ opt-level = 3

[profile.dev]
# Speeds up the build. May need to diable for debugging.
debug = 0
debug = 1
10 changes: 5 additions & 5 deletions crates/hir-analysis/src/ty/def_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl<'db> DefAnalyzer<'db> {

fn for_impl(db: &'db dyn HirAnalysisDb, impl_: HirImpl, ty: TyId) -> Self {
let assumptions = collect_impl_block_constraints(db, impl_);
let def = DefKind::Impl(impl_, ty);
let def = DefKind::Impl(impl_);
Self {
db,
def,
Expand Down Expand Up @@ -384,7 +384,7 @@ impl<'db> DefAnalyzer<'db> {
self.visit_impl_trait(&mut ctxt, impl_trait);
}

DefKind::Impl(hir_impl, _) => {
DefKind::Impl(hir_impl) => {
let mut ctxt = VisitorCtxt::with_impl(self.db.as_hir_db(), hir_impl);
self.visit_impl(&mut ctxt, hir_impl)
}
Expand Down Expand Up @@ -889,7 +889,7 @@ enum DefKind {
Adt(AdtDef),
Trait(TraitDef),
ImplTrait(Implementor),
Impl(HirImpl, TyId),
Impl(HirImpl),
Func(FuncDef),
}

Expand All @@ -899,7 +899,7 @@ impl DefKind {
Self::Adt(def) => def.params(db),
Self::Trait(def) => def.params(db),
Self::ImplTrait(def) => def.params(db),
Self::Impl(hir_impl, _) => {
Self::Impl(hir_impl) => {
collect_generic_params(db, GenericParamOwnerId::new(db, hir_impl.into())).params(db)
}
Self::Func(def) => def.params(db),
Expand Down Expand Up @@ -927,7 +927,7 @@ impl DefKind {
Self::Adt(def) => def.adt_ref(db).scope(db),
Self::Trait(def) => def.trait_(db).scope(),
Self::ImplTrait(def) => def.hir_impl_trait(db).scope(),
Self::Impl(hir_impl, _) => hir_impl.scope(),
Self::Impl(hir_impl) => hir_impl.scope(),
Self::Func(def) => def.hir_func(db).scope(),
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/hir/src/lower/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ impl DiagnosticVoucher for ParserError {

fn to_complete(&self, _db: &dyn SpannedHirDb) -> CompleteDiagnostic {
let error_code = self.error_code();
let span = Span::new(self.file, self.error.range, SpanKind::Original);
let span = Span::new(self.file, self.error.range(), SpanKind::Original);
CompleteDiagnostic::new(
Severity::Error,
self.error.msg.clone(),
self.error.msg(),
vec![SubDiagnostic::new(
LabelStyle::Primary,
self.error.msg.clone(),
self.error.label(),
Some(span),
)],
vec![],
Expand Down
Loading

0 comments on commit 57335f1

Please sign in to comment.