File tree Expand file tree Collapse file tree 4 files changed +14
-37
lines changed
scala3doc-testcases/src/tests Expand file tree Collapse file tree 4 files changed +14
-37
lines changed Original file line number Diff line number Diff line change @@ -73,10 +73,7 @@ class A {
73
73
*/
74
74
final def myMethod (s : String ): String = s
75
75
76
- /** This is a method.
77
- *
78
- * This is foo: $foo
79
- */
76
+ /** This is foo: $foo */
80
77
def method (s : String ): String = s
81
78
82
79
class AA
@@ -121,10 +118,7 @@ object A
121
118
class B extends A {
122
119
/** @inheritdoc */ override def method (s : String ): String = s
123
120
124
- /** This is a method.
125
- *
126
- * And this is my foo: $foo
127
- */
121
+ /** This is my foo: $foo */
128
122
def otherMethod (s : String ): String = s
129
123
130
124
class BB
@@ -145,7 +139,8 @@ object B {
145
139
val Z : Int = 0
146
140
}
147
141
148
- class C {
142
+ /** This is foo: $foo */
143
+ class C extends A {
149
144
object CC
150
145
class CC
151
146
}
@@ -215,6 +210,5 @@ class Methods:
215
210
*/
216
211
object O :
217
212
218
- /** This is foo: $foo
219
- */
213
+ /** This is foo: $foo */
220
214
def method (s : String ) = s
Original file line number Diff line number Diff line change @@ -22,10 +22,8 @@ trait ScaladocSupport { self: TastyParser =>
22
22
23
23
// println(s"Expanding comment for sym: ${tree.symbol.show}")
24
24
val sym = tree.symbol.asInstanceOf [dotc.core.Symbols .Symbol ]
25
- val owner =
26
- if tree.symbol.isClassDef then sym else sym.owner
27
25
28
- comments.CommentExpander .cookComment(sym, owner )(using ctx)
26
+ comments.CommentExpander .cookComment(sym)(using ctx)
29
27
.get.asInstanceOf [Documentation ]
30
28
else
31
29
commentPre
Original file line number Diff line number Diff line change @@ -344,6 +344,12 @@ import reporting.ProperDefinitionNotFound
344
344
}
345
345
346
346
object CommentExpander {
347
+
348
+ // TODO: handle package / non-class top-level definitions (possibly just return their comments?)
349
+ def cookComment (sym : Symbol )(using Context ): Option [Comment ] =
350
+ val owner = if sym.isClass then sym else sym.owner
351
+ cookComment(sym, owner)
352
+
347
353
def cookComment (sym : Symbol , owner : Symbol )(using Context ): Option [Comment ] =
348
354
ctx.docCtx.flatMap { docCtx =>
349
355
expand(sym, owner)(using ctx)(using docCtx)
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import scala.quoted.Quotes
4
4
5
5
import org .junit .{Test , Rule }
6
6
import org .junit .Assert .{assertSame , assertTrue }
7
- import dotty .dokka .BuildInfo
7
+ import dotty .dokka .tasty . util . _
8
8
9
9
class LookupTestCases [Q <: Quotes ](val q : Quotes ) {
10
10
@@ -118,27 +118,6 @@ class MemberLookupTests {
118
118
cases.testAll()
119
119
}
120
120
121
- Inspector ().inspectTastyFiles(listOurClasses())
122
- }
123
-
124
- def listOurClasses (): List [String ] = {
125
- import java .io .File
126
- import scala .collection .mutable .ListBuffer
127
-
128
- val classRoot = new File (BuildInfo .test_testcasesOutputDir)
129
-
130
- def go (bld : ListBuffer [String ])(file : File ): Unit =
131
- file.listFiles.foreach { f =>
132
- if f.isFile() then
133
- if f.toString.endsWith(" .tasty" ) then bld.append(f.toString)
134
- else go(bld)(f)
135
- }
136
-
137
- if classRoot.isDirectory then
138
- val bld = new ListBuffer [String ]
139
- go(bld)(classRoot)
140
- bld.result
141
- else
142
- sys.error(s " Class root could not be found: $classRoot" )
121
+ Inspector ().inspectTastyFiles(TestUtils .listOurClasses())
143
122
}
144
123
}
You can’t perform that action at this time.
0 commit comments