Skip to content

Commit

Permalink
Merge pull request #945 from Y-Nak/dependent-ty
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Nak authored Jan 28, 2024
2 parents d664a7a + f11c1b0 commit 1b7c7e9
Show file tree
Hide file tree
Showing 51 changed files with 2,078 additions and 531 deletions.
35 changes: 25 additions & 10 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions crates/hir-analysis/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ hir = { path = "../hir", package = "fe-hir" }
common = { path = "../common2", package = "fe-common2" }
macros = { path = "../macros", package = "fe-macros" }
fe-compiler-test-utils = { path = "../test-utils" }
num-bigint = "0.4"
once_cell = "1.18"
regex = "1.10"

[dev-dependencies]
codespan-reporting = "0.11"
Expand Down
5 changes: 5 additions & 0 deletions crates/hir-analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ pub struct Jar(
ty::ty_def::AdtDef,
ty::ty_def::FuncDef,
ty::ty_def::AdtRefId,
/// Const types.
ty::const_ty::ConstTyId,
ty::const_ty::evaluate_const_ty,
/// Type lowering.
ty::ty_lower::lower_hir_ty,
ty::ty_lower::lower_adt,
ty::ty_lower::lower_func,
ty::ty_lower::lower_type_alias,
ty::ty_lower::collect_generic_params,
ty::ty_lower::GenericParamOwnerId,
ty::ty_lower::GenericParamTypeSet,
ty::ty_lower::evaluate_params_precursor,
/// Trait lowering.
ty::trait_lower::lower_trait,
ty::trait_lower::lower_trait_ref,
Expand Down
3 changes: 1 addition & 2 deletions crates/hir-analysis/src/name_resolution/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ use hir::{
HirDb,
};

use crate::HirAnalysisDb;

use super::NameRes;
use crate::HirAnalysisDb;

#[salsa::accumulator]
pub struct NameResolutionDiagAccumulator(pub(super) NameResDiag);
Expand Down
7 changes: 3 additions & 4 deletions crates/hir-analysis/src/name_resolution/import_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ use hir::{
use itertools::Itertools;
use rustc_hash::{FxHashMap, FxHashSet};

use crate::{name_resolution::visibility_checker::is_use_visible, HirAnalysisDb};

use super::{
diagnostics::NameResDiag,
name_resolver::{
NameDerivation, NameDomain, NameQuery, NameRes, NameResBucket, NameResKind,
NameResolutionError, NameResolutionResult, NameResolver, QueryDirective,
},
};
use crate::{name_resolution::visibility_checker::is_use_visible, HirAnalysisDb};

pub(crate) struct ImportResolver<'db> {
db: &'db dyn HirAnalysisDb,
Expand Down Expand Up @@ -473,8 +472,8 @@ impl<'db> ImportResolver<'db> {
// the `i_use` resolution.
//
// This is because:
// 1. the resolution of the first segment changes depending on whether the
// dependent glob is resolved or not at the time of `i_use` resolution,
// 1. the resolution of the first segment changes depending on whether the const
// glob is resolved or not at the time of `i_use` resolution,
// 2. the order in which uses are resolved is nondeterministic.
//
// In normal name resolution rules, the name brought in by a glob always shadows
Expand Down
16 changes: 7 additions & 9 deletions crates/hir-analysis/src/name_resolution/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ mod path_resolver;
mod visibility_checker;

use either::Either;
pub use import_resolver::ResolvedImports;
pub use name_resolver::{
NameDerivation, NameDomain, NameQuery, NameRes, NameResBucket, NameResKind, QueryDirective,
};
pub use path_resolver::EarlyResolvedPath;

use hir::{
analysis_pass::ModuleAnalysisPass,
diagnostics::DiagnosticVoucher,
Expand All @@ -21,16 +15,20 @@ use hir::{
},
visitor::prelude::*,
};
pub use import_resolver::ResolvedImports;
pub use name_resolver::{
NameDerivation, NameDomain, NameQuery, NameRes, NameResBucket, NameResKind, QueryDirective,
};
pub use path_resolver::EarlyResolvedPath;
use rustc_hash::FxHashSet;

use crate::HirAnalysisDb;

use self::{
diagnostics::{ImportResolutionDiagAccumulator, NameResDiag, NameResolutionDiagAccumulator},
import_resolver::DefaultImporter,
name_resolver::{NameResolutionError, ResolvedQueryCacheStore},
path_resolver::EarlyPathResolver,
};
use crate::HirAnalysisDb;

// TODO: Implement `resolve_path` and `resolve_segments` after implementing the
// late path resolution.
Expand Down Expand Up @@ -296,7 +294,7 @@ impl<'db, 'a> EarlyPathVisitor<'db, 'a> {
return;
};

let domain = NameDomain::from_scope(scope);
let domain = NameDomain::from_scope(self.db, scope);
let binding = self.inner.resolve_query(query);
match binding.pick(domain) {
Ok(_) => {}
Expand Down
Loading

0 comments on commit 1b7c7e9

Please sign in to comment.