@@ -124,14 +124,16 @@ class SemanticdbConsumer extends TastyConsumer {
124
124
symbol.name == " <init>"
125
125
126
126
def isSyntheticConstructor (implicit ctx : Context ): Boolean = {
127
+ val isObjectConstructor = symbol.isConstructor && symbol.owner != NoSymbol && symbol.owner.flags.is(Flags .Object )
128
+ // println("====>", symbol, symbol.owner, symbol.owner.flags, symbol.owner.flags.isObject, isObjectConstructor)
127
129
val isModuleConstructor = symbol.isConstructor && symbol.owner.isClass
128
130
val isTraitConstructor = symbol.isConstructor && symbol.owner.isTrait
129
131
val isInterfaceConstructor = symbol.isConstructor && symbol.owner.flags.is(Flags .JavaDefined ) && symbol.owner.isTrait
130
132
val isEnumConstructor = symbol.isConstructor && symbol.owner.flags.is(Flags .JavaDefined ) && symbol.owner.flags.is(Flags .Enum )
131
133
/* val isStaticConstructor = symbol.name == g.TermName("<clinit>")*/
132
134
// val isClassfileAnnotationConstructor = symbol.owner.isClassfileAnnotation
133
135
/* isModuleConstructor || */
134
- isTraitConstructor || isInterfaceConstructor ||
136
+ isTraitConstructor || isInterfaceConstructor || isObjectConstructor ||
135
137
isEnumConstructor /* || isStaticConstructor || isClassfileAnnotationConstructor*/
136
138
}
137
139
def isLocalChild (implicit ctx : Context ): Boolean =
@@ -289,9 +291,8 @@ class SemanticdbConsumer extends TastyConsumer {
289
291
/* When we consider snipper of the form: `abstract class DepAdvD[CC[X[C] <: B], X[Z], C] extends DepTemp`,
290
292
The symbol for C will be something like example/DepAdvD#`<init>`().[CC].[X].[C].
291
293
This is illogic: a init method can't have any child. Thus, when the current symbol is
292
- a typeparameter (or anything, but here it is just implemented for type parameter), and the owner
293
- is an init, we can just "jump" over the init. */
294
- if (symbol.isTypeParameter && symbol.owner.name == " <init>" )
294
+ a typeparameter (or anything), and the owner is an init, we can just "jump" over the init. */
295
+ if (symbol.owner.name == " <init>" )
295
296
iterateParent(symbol.owner.owner)
296
297
else
297
298
iterateParent(symbol.owner)
@@ -343,8 +344,8 @@ class SemanticdbConsumer extends TastyConsumer {
343
344
(iterateParent(symbol), true )
344
345
}
345
346
346
- println(symbol_path, range)
347
347
if (symbol_path == " " || symbol.isUselessOccurrence) return
348
+ println(symbol_path, range, symbol.owner.flags)
348
349
349
350
val key = (symbol_path, range)
350
351
if (! is_global || ! (symbolPathsMap.contains(key))) {
@@ -509,8 +510,8 @@ class SemanticdbConsumer extends TastyConsumer {
509
510
addOccurenceTree(tree,
510
511
s.SymbolOccurrence .Role .DEFINITION ,
511
512
range(tree, tree.symbol.pos, tree.symbol.name))
512
- println(" constr symbol pos: " , constr.symbol.pos.startColumn, constr.symbol.pos.endColumn)
513
- println(" constr pos: " , constr.pos.startColumn, constr.pos.endColumn)
513
+ // println("constr symbol pos: ", constr.symbol.pos.startColumn, constr.symbol.pos.endColumn)
514
+ // println("constr pos: ", constr.pos.startColumn, constr.pos.endColumn)
514
515
// then the constructor
515
516
if (! constr.isUserCreated) {
516
517
fittedInitClassRange = Some (
@@ -575,8 +576,9 @@ class SemanticdbConsumer extends TastyConsumer {
575
576
}
576
577
if (tree.symbol.name != " <none>" ) {
577
578
val range_symbol = range(tree, tree.symbol.pos, tree.symbol.name)
578
- if (tree.symbol.name == " <init>" && tree.symbol.flags.is(Flags .Object )) {
579
-
579
+ // println(tree, tree.symbol.name, tree.symbol.owner, tree.symbol.owner.flags)
580
+ if (tree.symbol.name == " <init>" && tree.symbol.owner != NoSymbol && tree.symbol.owner.flags.is(Flags .Object )) {
581
+ // println("omitting", tree.symbol.name)
580
582
} else if (tree.symbol.name == " <init>" && fittedInitClassRange != None ) {
581
583
addOccurenceTree(tree,
582
584
s.SymbolOccurrence .Role .DEFINITION ,
@@ -604,7 +606,7 @@ class SemanticdbConsumer extends TastyConsumer {
604
606
addOccurenceTree(tree,
605
607
s.SymbolOccurrence .Role .REFERENCE ,
606
608
range,
607
- false )
609
+ true )
608
610
super .traverseTree(tree)
609
611
}
610
612
0 commit comments