This commit is contained in:
Lukas Wirth 2022-03-05 23:53:24 +01:00
parent b454f11f38
commit 0bb631bf71
2 changed files with 6 additions and 9 deletions

View file

@ -3,7 +3,7 @@
use crate::intern::Interned; use crate::intern::Interned;
use either::Either; use either::Either;
use hir_expand::name::{known, name, AsName}; use hir_expand::name::{name, AsName};
use syntax::ast::{self, AstNode, HasTypeBounds}; use syntax::ast::{self, AstNode, HasTypeBounds};
use super::AssociatedTypeBinding; use super::AssociatedTypeBinding;
@ -54,7 +54,7 @@ pub(super) fn lower_path(mut path: ast::Path, ctx: &LowerCtx) -> Option<Path> {
} }
} }
ast::PathSegmentKind::SelfTypeKw => { ast::PathSegmentKind::SelfTypeKw => {
segments.push(known::SELF_TYPE); segments.push(name![Self]);
generic_args.push(None) generic_args.push(None)
} }
ast::PathSegmentKind::Type { type_ref, trait_ref } => { ast::PathSegmentKind::Type { type_ref, trait_ref } => {

View file

@ -167,13 +167,10 @@ fn convert_path(
} }
} }
ast::PathSegmentKind::SelfTypeKw => { ast::PathSegmentKind::SelfTypeKw => {
let mut res = prefix.unwrap_or_else(|| { if prefix.is_some() {
ModPath::from_kind( return None;
segment.coloncolon_token().map_or(PathKind::Plain, |_| PathKind::Abs), }
) ModPath::from_segments(PathKind::Plain, Some(known::SELF_TYPE))
});
res.segments.push(known::SELF_TYPE);
res
} }
ast::PathSegmentKind::CrateKw => { ast::PathSegmentKind::CrateKw => {
if prefix.is_some() { if prefix.is_some() {