Skip to content

Commit

Permalink
fix: check pseudo-block by local_id instead of ModuleOrigin
Browse files Browse the repository at this point in the history
  • Loading branch information
roife committed May 22, 2024
1 parent 719eee2 commit 4e9b128
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ use crate::{
db::DefDatabase,
item_scope::{ImportOrExternCrate, BUILTIN_SCOPE},
item_tree::Fields,
nameres::{
sub_namespace_match, BlockInfo, BuiltinShadowMode, DefMap, MacroSubNs, ModuleOrigin,
},
nameres::{sub_namespace_match, BlockInfo, BuiltinShadowMode, DefMap, MacroSubNs},
path::{ModPath, PathKind},
per_ns::PerNs,
visibility::{RawVisibility, Visibility},
Expand Down Expand Up @@ -472,7 +470,7 @@ impl DefMap {
};

let extern_prelude = || {
if matches!(self[module].origin, ModuleOrigin::BlockExpr { .. }) {
if self.block.is_some() && module == DefMap::ROOT {
// Don't resolve extern prelude in pseudo-modules of blocks, because
// they might been shadowed by local names.
return PerNs::none();
Expand Down Expand Up @@ -518,7 +516,7 @@ impl DefMap {
None => self[Self::ROOT].scope.get(name),
};
let from_extern_prelude = || {
if matches!(self[module].origin, ModuleOrigin::BlockExpr { .. }) {
if self.block.is_some() && module == DefMap::ROOT {
// Don't resolve extern prelude in pseudo-module of a block.
return PerNs::none();
}
Expand Down

0 comments on commit 4e9b128

Please sign in to comment.