Skip to content

Commit

Permalink
Apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
noti0na1 committed Apr 26, 2024
1 parent e6b00c3 commit d192e48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/transform/CheckUnused.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class CheckUnused private (phaseMode: CheckUnused.PhaseMode, suffix: String, _ke
ctx

override def prepareForSelect(tree: tpd.Select)(using Context): Context =
val name = tree.getAttachment(OriginalName).orElse(Some(tree.name))
val name = tree.removeAttachment(OriginalName).orElse(Some(tree.name))
unusedDataApply(_.registerUsed(tree.symbol, name))

override def prepareForBlock(tree: tpd.Block)(using Context): Context =
Expand Down
7 changes: 5 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
val checkedType = checkNotShadowed(ownType)
val tree1 = checkedType match
case checkedType: NamedType if !prefixIsElidable(checkedType) =>
ref(checkedType).withSpan(tree.span).withAttachment(OriginalName, name)
ref(checkedType).withSpan(tree.span)
case _ =>
def isScalaModuleRef = checkedType match
case moduleRef: TypeRef if moduleRef.symbol.is(ModuleClass, butNot = JavaDefined) => true
Expand Down Expand Up @@ -663,7 +663,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
val selection = untpd.cpy.Select(tree)(qualifier, name)
typed(selection, pt)
else if rawType.exists then
setType(ensureAccessible(rawType, superAccess = false, tree.srcPos))
val ref = setType(ensureAccessible(rawType, superAccess = false, tree.srcPos))
if ref.symbol.name != name then
ref.withAttachment(OriginalName, name)
else ref
else if name == nme._scope then
// gross hack to support current xml literals.
// awaiting a better implicits based solution for library-supported xml
Expand Down

0 comments on commit d192e48

Please sign in to comment.