Skip to content

Commit

Permalink
improvement: add info needed for running tests to symbol info
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek committed Jul 25, 2024
1 parent d2c6d60 commit 2cfc561
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dotty.tools.pc

import scala.collection.mutable
import scala.util.control.NonFatal

import scala.meta.pc.PcSymbolKind
Expand Down Expand Up @@ -37,11 +38,25 @@ class SymbolInformationProvider(using Context):
if classSym.isClass
then classSym.asClass.parentSyms.map(SemanticdbSymbols.symbolName)
else Nil
val allParents =
val visited = mutable.Set[Symbol]()
def collect(sym: Symbol): Unit = {
visited += sym
if sym.isClass
then sym.asClass.parentSyms.foreach {
case parent if !visited(parent) =>
collect(parent)
case _ =>
}
}
collect(classSym)
visited.toList.map(SemanticdbSymbols.symbolName)
val dealisedSymbol =
if sym.isAliasType then sym.info.deepDealias.typeSymbol else sym
val classOwner =
sym.ownersIterator.drop(1).find(s => s.isClass || s.is(Flags.Module))
val overridden = sym.denot.allOverriddenSymbols.toList
val memberDefAnnots = sym.info.membersBasedOnFlags(Flags.Method, Flags.EmptyFlags).flatMap(_.allSymbols).flatMap(_.denot.annotations)

val pcSymbolInformation =
PcSymbolInformation(
Expand All @@ -56,6 +71,9 @@ class SymbolInformationProvider(using Context):
properties =
if sym.is(Flags.Abstract) then List(PcSymbolProperty.ABSTRACT)
else Nil,
recursiveParents = allParents,
annotations = sym.denot.annotations.map(_.symbol.showFullName),
memberDefsAnnotations = memberDefAnnots.map(_.symbol.showFullName).toList
)

Some(pcSymbolInformation)
Expand Down
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ object Build {
BuildInfoPlugin.buildInfoDefaultSettings

lazy val presentationCompilerSettings = {
val mtagsVersion = "1.3.2"
val mtagsVersion = "1.3.3"
Seq(
libraryDependencies ++= Seq(
"org.lz4" % "lz4-java" % "1.8.0",
Expand Down

0 comments on commit 2cfc561

Please sign in to comment.