Skip to content

Commit eb580a3

Browse files
committed
fix package path printing
1 parent 863544f commit eb580a3

File tree

2 files changed

+32
-18
lines changed

2 files changed

+32
-18
lines changed

semanticdb/src/dotty/semanticdb/SemanticdbConsumer.scala

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,22 @@ class SemanticdbConsumer extends TastyConsumer {
318318
localsymbol
319319
}
320320
} else {
321-
println("golbal: ", symbol)
321+
println("global: ", symbol)
322322
iterateParent(symbol)
323323
}
324-
324+
/*println(symbol, symbol.isUselessOccurrence)
325+
326+
println(symbol, "isWildCard", symbol.isWildCard)
327+
println(symbol, "isAnonymousCl", symbol.isAnonymousClass)
328+
println(symbol, "isAnonymousFun", symbol.isAnonymousFunction)
329+
println(symbol, "isSyntheticCon", symbol.isSyntheticConstructor)
330+
println(symbol, "isStaticConstr", symbol.isStaticConstructor)
331+
println(symbol, "isLocalChil", symbol.isLocalChild)
332+
println(symbol, "isSyntheticVal", symbol.isSyntheticValueClassCompanion)
333+
println(symbol, "isUselessFie", symbol.isUselessField)
334+
println(symbol, "isSyntheticCas", symbol.isSyntheticCaseAccessor)
335+
println(symbol, "isRefinementCl", symbol.isRefinementClass)
336+
println(symbol, "isSyntheticJav", symbol.isSyntheticJavaModule)*/
325337
if (symbol_path == "" || symbol.isUselessOccurrence) return
326338

327339
occurrences =
@@ -482,7 +494,9 @@ class SemanticdbConsumer extends TastyConsumer {
482494
}*/
483495

484496
override def traverseTree(tree: Tree)(implicit ctx: Context): Unit = {
485-
//println(tree.pos.startColumn, tree.symbol.name, tree.pos.endColumn)
497+
println("\n")
498+
println(tree)
499+
println(tree.pos.startColumn, tree.symbol.name, tree.pos.endColumn)
486500
tree match {
487501
case Import(path, selectors) =>
488502
val key = (tree.symbol.name, tree.pos.start)
@@ -525,7 +539,8 @@ class SemanticdbConsumer extends TastyConsumer {
525539
}
526540
if (tree.symbol.name != "<none>") {
527541
val range_symbol = range(tree, tree.symbol.pos, tree.symbol.name)
528-
/*if (tree.symbol.name == "<init>" && !tree.isUserCreated && !tree.symbol.owner.flags.is(Flags.Object) ) {
542+
if (tree.symbol.name == "<init>" && !tree.isUserCreated && !tree.symbol.owner.flags.is(Flags.Object) ) {
543+
println("YES")
529544
val range_symbol2 = s.Range(range_symbol.startLine,
530545
range_symbol.startCharacter - 4,
531546
range_symbol.endLine,
@@ -535,7 +550,7 @@ class SemanticdbConsumer extends TastyConsumer {
535550
range_symbol2,
536551
true)
537552

538-
} else */ {
553+
} else {
539554
addOccurenceTree(tree,
540555
s.SymbolOccurrence.Role.DEFINITION,
541556
range_symbol)
@@ -551,12 +566,10 @@ class SemanticdbConsumer extends TastyConsumer {
551566
}
552567

553568
case Term.Ident(name) => {
554-
// To avoid adding the identifier of the package symbol
555-
if (tree.symbol.owner.name != "<root>") {
556-
addOccurenceTree(tree,
557-
s.SymbolOccurrence.Role.REFERENCE,
558-
range(tree, tree.pos, tree.symbol.name))
559-
}
569+
addOccurenceTree(tree,
570+
s.SymbolOccurrence.Role.REFERENCE,
571+
range(tree, tree.pos, tree.symbol.name))
572+
560573
super.traverseTree(tree)
561574
}
562575
case PackageClause(_) =>
@@ -575,6 +588,7 @@ class SemanticdbConsumer extends TastyConsumer {
575588
}
576589

577590
}
591+
println(root)
578592
Traverser.traverseTree(root)(reflect.rootContext)
579593
}
580594

semanticdb/test/dotty/semanticdb/Tests.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ class Tests {
177177

178178
//@Test def testAccess(): Unit = checkFile("example/Access.scala")
179179
//@Test def testAdvanced(): Unit = checkFile("example/Advanced.scala")
180-
@Test def testAnonymous(): Unit = checkFile("example/Anonymous.scala")
181-
//WIP(assert because of case) @Test def testClasses(): Unit = checkFile("example/Classes.scala")
180+
//@Test def testAnonymous(): Unit = checkFile("example/Anonymous.scala")
181+
//@Test def testClasses(): Unit = checkFile("example/Classes.scala")
182182
//@Test def testEmpty(): Unit = checkFile("example/Empty.scala")
183183
//@Test def testEmptyObject(): Unit = checkFile("example/EmptyObject.scala")
184184
//@Test def testExample(): Unit = checkFile("example/Example.scala")
185-
//WIP @Test def testExample2(): Unit = checkFile("example/Example2.scala")
185+
@Test def testExample2(): Unit = checkFile("example/Example2.scala")
186186
//@Test def testExclude(): Unit = checkFile("example/Exclude.scala")
187-
//WIP(assert) @Test def testFlags(): Unit = checkFile("example/Flags.scala")
187+
//WIP @Test def testFlags(): Unit = checkFile("example/Flags.scala")
188188
//@Test def testImports(): Unit = checkFile("example/Imports.scala")
189189
//@Test def testIssue1749(): Unit = checkFile("example/Issue1749.scala")
190190
//@Test def testLocalFile(): Unit = checkFile("example/local-file.scala")
@@ -196,11 +196,11 @@ class Tests {
196196
//@Test def testOverrides(): Unit = checkFile("example/Overrides.scala")
197197
//WIP @Test def testPrefixes(): Unit = checkFile("example/Prefixes.scala")
198198
//@Test def testSelfs(): Unit = checkFile("example/Selfs.scala")
199-
//WIP(assert nodenotation owner) @Test def testSynthetic(): Unit = checkFile("example/Synthetic.scala")
199+
//WIP @Test def testSynthetic(): Unit = checkFile("example/Synthetic.scala")
200200
//WIP @Test def testTraits(): Unit = checkFile("example/Traits.scala")
201-
//WIP(assert) @Test def testTypes(): Unit = checkFile("example/Types.scala")
201+
//WIP @Test def testTypes(): Unit = checkFile("example/Types.scala")
202202
//WIP @Test def testVals(): Unit = checkFile("example/Vals.scala")
203-
@Test def testIgnoredSymbol(): Unit = checkFile("example/IgnoredSymbol.scala")
203+
//@Test def testIgnoredSymbol(): Unit = checkFile("example/IgnoredSymbol.scala")
204204

205205

206206
def testOutput(className: String, expected: String): Unit = {

0 commit comments

Comments
 (0)