Skip to content

Commit 2cfc561

Browse files
committed
improvement: add info needed for running tests to symbol info
1 parent d2c6d60 commit 2cfc561

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

presentation-compiler/src/main/dotty/tools/pc/SymbolInformationProvider.scala

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dotty.tools.pc
22

3+
import scala.collection.mutable
34
import scala.util.control.NonFatal
45

56
import scala.meta.pc.PcSymbolKind
@@ -37,11 +38,25 @@ class SymbolInformationProvider(using Context):
3738
if classSym.isClass
3839
then classSym.asClass.parentSyms.map(SemanticdbSymbols.symbolName)
3940
else Nil
41+
val allParents =
42+
val visited = mutable.Set[Symbol]()
43+
def collect(sym: Symbol): Unit = {
44+
visited += sym
45+
if sym.isClass
46+
then sym.asClass.parentSyms.foreach {
47+
case parent if !visited(parent) =>
48+
collect(parent)
49+
case _ =>
50+
}
51+
}
52+
collect(classSym)
53+
visited.toList.map(SemanticdbSymbols.symbolName)
4054
val dealisedSymbol =
4155
if sym.isAliasType then sym.info.deepDealias.typeSymbol else sym
4256
val classOwner =
4357
sym.ownersIterator.drop(1).find(s => s.isClass || s.is(Flags.Module))
4458
val overridden = sym.denot.allOverriddenSymbols.toList
59+
val memberDefAnnots = sym.info.membersBasedOnFlags(Flags.Method, Flags.EmptyFlags).flatMap(_.allSymbols).flatMap(_.denot.annotations)
4560

4661
val pcSymbolInformation =
4762
PcSymbolInformation(
@@ -56,6 +71,9 @@ class SymbolInformationProvider(using Context):
5671
properties =
5772
if sym.is(Flags.Abstract) then List(PcSymbolProperty.ABSTRACT)
5873
else Nil,
74+
recursiveParents = allParents,
75+
annotations = sym.denot.annotations.map(_.symbol.showFullName),
76+
memberDefsAnnotations = memberDefAnnots.map(_.symbol.showFullName).toList
5977
)
6078

6179
Some(pcSymbolInformation)

project/Build.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ object Build {
13591359
BuildInfoPlugin.buildInfoDefaultSettings
13601360

13611361
lazy val presentationCompilerSettings = {
1362-
val mtagsVersion = "1.3.2"
1362+
val mtagsVersion = "1.3.3"
13631363
Seq(
13641364
libraryDependencies ++= Seq(
13651365
"org.lz4" % "lz4-java" % "1.8.0",

0 commit comments

Comments
 (0)