Skip to content

Commit d548b91

Browse files
committed
Style comments
1 parent 1e205de commit d548b91

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

compiler/src/dotty/tools/dotc/interactive/Interactive.scala

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ object Interactive {
5454
path.dropWhile(!_.symbol.exists).headOption.getOrElse(tpd.EmptyTree)
5555

5656
/**
57-
* The source symbol that is the closest to `path`.
57+
* The source symbols that are the closest to `path`.
5858
*
59-
* @param path The path to the tree whose symbol to extract.
60-
* @return The source symbol that is the closest to `path`.
59+
* If this path ends in an import, then this returns all the symbols that are imported by this
60+
* import statement.
61+
*
62+
* @param path The path to the tree whose symbols to extract.
63+
* @return The source symbols that are the closest to `path`.
6164
*
6265
* @see sourceSymbol
6366
*/
@@ -69,20 +72,20 @@ object Interactive {
6972
if (funSym.name == StdNames.nme.copy
7073
&& funSym.is(Synthetic)
7174
&& funSym.owner.is(CaseClass)) {
72-
funSym.owner.info.member(name).symbol :: Nil
75+
List(funSym.owner.info.member(name).symbol)
7376
} else {
7477
val classTree = funSym.topLevelClass.asClass.rootTree
7578
val paramSymbol =
7679
for {
7780
DefDef(_, _, paramss, _, _) <- tpd.defPath(funSym, classTree).lastOption
7881
param <- paramss.flatten.find(_.name == name)
7982
} yield param.symbol
80-
paramSymbol.getOrElse(fn.symbol) :: Nil
83+
List(paramSymbol.getOrElse(fn.symbol))
8184
}
8285

8386
// For constructor calls, return the `<init>` that was selected
8487
case _ :: (_: New) :: (select: Select) :: _ =>
85-
select.symbol :: Nil
88+
List(select.symbol)
8689

8790
case (_: Thicket) :: (imp: Import) :: _ =>
8891
importedSymbols(imp, _.pos.contains(pos.pos))
@@ -91,7 +94,7 @@ object Interactive {
9194
importedSymbols(imp, _.pos.contains(pos.pos))
9295

9396
case _ =>
94-
enclosingTree(path).symbol :: Nil
97+
List(enclosingTree(path).symbol)
9598
}
9699

97100
syms.map(Interactive.sourceSymbol).filter(_.exists)
@@ -598,10 +601,10 @@ object Interactive {
598601
*/
599602
private def importedSymbols(expr: tpd.Tree, name: Name)(implicit ctx: Context): List[Symbol] = {
600603
def lookup(name: Name): Symbol = expr.tpe.member(name).symbol
601-
lookup(name.toTermName) ::
602-
lookup(name.toTypeName) ::
603-
lookup(name.moduleClassName) ::
604-
lookup(name.sourceModuleName) :: Nil
604+
List(lookup(name.toTermName),
605+
lookup(name.toTypeName),
606+
lookup(name.moduleClassName),
607+
lookup(name.sourceModuleName))
605608
}
606609

607610
/**

0 commit comments

Comments
 (0)