@@ -4,6 +4,7 @@ import dotty.tools.dotc.ast.tpd._
4
4
import dotty .tools .dotc .core .Contexts ._
5
5
import dotty .tools .dotc .core .Flags ._
6
6
import dotty .tools .dotc .core .StdNames .nme
7
+ import dotty .tools .dotc .core .NameKinds
7
8
import dotty .tools .dotc .{semanticdb => s }
8
9
9
10
@@ -26,8 +27,21 @@ class SyntheticsExtractor:
26
27
tree match
27
28
case tree : TypeApply
28
29
if tree.span.isSynthetic &&
29
- tree.args.forall(arg => ! arg.symbol.is(Scala2x )) &&
30
- ! tree.span.isZeroExtent =>
30
+ tree.args.forall(arg => ! arg.symbol.isDefinedInSource) &&
31
+ ! tree.span.isZeroExtent &&
32
+ (tree.fun match {
33
+ // for `Bar[Int]` of `class Foo extends Bar[Int]`
34
+ // we'll have `TypeTree(Select(New(AppliedTypeTree(...))), List(Int))`
35
+ // in this case, don't register `*[Int]` to synthetics as we already have `[Int]` in source.
36
+ case Select (New (AppliedTypeTree (_, _)), _) => false
37
+
38
+ // for `new SomeJavaClass[Int]()`
39
+ // there will be a synthesized default getter
40
+ // in addition to the source derived one.
41
+ case Select (_, name) if name.is(NameKinds .DefaultGetterName ) => false
42
+ case Select (fun, _) if fun.symbol.name.isDynamic => false
43
+ case _ => true
44
+ }) =>
31
45
visited.add(tree)
32
46
val fnTree = tree.fun match
33
47
// Something like `List.apply[Int](1,2,3)`
0 commit comments