Commit 8c8eae9
authored
[SemanticDB] fix regression in type apply synthetics (#16031)
This PR fixes the regressions in SemanticDB's TypeApply synthetics
introduced by #15877
-
e835dc0
-
097b179
-
097b179
Previously, we relies on `Scala2` flag for filtering out some
synthetics, which isn't reliable for SemanticDB (that's why the capture
checking made a change in how the compiler put flags to symbols and the
regression occurred).
This PR fixes the regression by re-implements TypeApply synthetics
without using `Scala2` flag.
(also fix scalameta/metals#4372)
Probably, it makes more sense to compare the `metac.expect`'s diff from
53e1adc which was something before the
regression.
<details>
<summary>diff from 53e1adc</summary>
`git diff 53e1adc HEAD
tests/semanticdb/metac.expect`
```diff
diff --git a/tests/semanticdb/metac.expect b/tests/semanticdb/metac.expect
index 5e20650..2c7f720 100644
--- a/tests/semanticdb/metac.expect
+++ b/tests/semanticdb/metac.expect
@@ -50,7 +50,7 @@ Text => empty
Language => Scala
Symbols => 60 entries
Occurrences => 132 entries
-Synthetics => 4 entries
+Synthetics => 3 entries
Symbols:
advanced/C# => class C [typeparam T ] extends Object { self: C[T] => +3 decls }
@@ -252,7 +252,6 @@ Synthetics:
[27:12..27:16):s.s1 => reflectiveSelectable(*)
[29:12..29:16):s.s2 => reflectiveSelectable(*)
[31:12..31:16):s.s3 => reflectiveSelectable(*)
-[47:19..47:24):foo.a => *[foo.A]
expect/Annotations.scala
------------------------
@@ -264,7 +263,6 @@ Text => empty
Language => Scala
Symbols => 23 entries
Occurrences => 52 entries
-Synthetics => 2 entries
Symbols:
annot/Alias. => final object Alias extends Object { self: Alias.type => +2 decls }
@@ -345,10 +343,6 @@ Occurrences:
[39:11..39:26): ClassAnnotation -> com/javacp/annot/ClassAnnotation#
[39:28..39:33): param -> scala/annotation/meta/param#
-Synthetics:
-[25:2..25:20):@throws[Exception] => *[Exception]
-[25:2..25:20):@throws[Exception] => *[Exception]
-
expect/Anonymous.scala
----------------------
@@ -896,7 +890,7 @@ Text => empty
Language => Scala
Symbols => 181 entries
Occurrences => 148 entries
-Synthetics => 10 entries
+Synthetics => 6 entries
Symbols:
_empty_/Enums. => final object Enums extends Object { self: Enums.type => +30 decls }
@@ -1232,16 +1226,12 @@ Occurrences:
[68:25..68:31): Planet -> _empty_/Enums.Planet#
Synthetics:
-[46:28..46:35):C <:< C => *[C, C]
-[49:27..49:31):Refl => *.apply[T]
[52:9..52:13):Refl => *.unapply[Option[B]]
-[52:19..52:30):opt.flatMap => *[B]
[52:31..52:50):identity[Option[B]] => *[Function1[A, Option[B]]]
[54:14..54:18):Some => *.apply[Some[Int]]
[54:14..54:34):Some(Some(1)).unwrap => *(given_<:<_T_T[Option[Int]])
[54:19..54:23):Some => *.apply[Int]
[54:28..54:34):unwrap => *[Some[Int], Int]
-[56:52..56:64):Enum[Planet] => *[Planet]
expect/EtaExpansion.scala
-------------------------
@@ -3165,7 +3155,7 @@ Text => empty
Language => Scala
Symbols => 52 entries
Occurrences => 132 entries
-Synthetics => 36 entries
+Synthetics => 39 entries
Symbols:
example/Synthetic# => class Synthetic extends Object { self: Synthetic => +23 decls }
@@ -3361,12 +3351,15 @@ Synthetics:
[6:2..6:18):Array.empty[Int] => intArrayOps(*)
[7:2..7:8):"fooo" => augmentString(*)
[10:13..10:24):"name:(.*)" => augmentString(*)
+[11:8..11:11):#:: => *.unapply[Int]
[11:17..11:25):LazyList => *.apply[Int]
[13:4..13:28):#:: 2 #:: LazyList.empty => *[Int]
[13:8..13:28):2 #:: LazyList.empty => toDeferrer[Int](*)
[13:10..13:28):#:: LazyList.empty => *[Int]
[13:14..13:28):LazyList.empty => toDeferrer[Nothing](*)
[13:14..13:28):LazyList.empty => *[Nothing]
+[15:9..15:12):#:: => *.unapply[Int]
+[15:16..15:19):#:: => *.unapply[Int]
[15:25..15:33):LazyList => *.apply[Int]
[17:14..17:38):#:: 2 #:: LazyList.empty => *[Int]
[17:18..17:38):2 #:: LazyList.empty => toDeferrer[Int](*)
@@ -3471,7 +3464,7 @@ Text => empty
Language => Scala
Symbols => 22 entries
Occurrences => 46 entries
-Synthetics => 7 entries
+Synthetics => 11 entries
Symbols:
example/ValPattern# => class ValPattern extends Object { self: ValPattern => +14 decls }
@@ -3546,12 +3539,16 @@ Occurrences:
[40:10..40:18): rightVar -> local4
Synthetics:
+[5:6..5:10):Some => *.unapply[Int]
[6:4..6:8):Some => *.apply[Int]
[8:6..8:10):List => *.unapplySeq[Nothing]
[8:11..8:15):Some => *.unapply[Nothing]
+[11:6..11:10):Some => *.unapply[Int]
[12:4..12:8):Some => *.apply[Int]
[25:4..25:11):locally => *[Unit]
+[27:10..27:14):Some => *.unapply[Int]
[28:8..28:12):Some => *.apply[Int]
+[31:10..31:14):Some => *.unapply[Int]
[32:8..32:12):Some => *.apply[Int]
expect/Vals.scala
@@ -4264,7 +4261,6 @@ Text => empty
Language => Scala
Symbols => 36 entries
Occurrences => 46 entries
-Synthetics => 3 entries
Symbols:
local0 => type N$1 <: Nat
@@ -4352,11 +4348,6 @@ Occurrences:
[23:35..23:39): Zero -> recursion/Nats.Zero.
[23:40..23:42): ++ -> recursion/Nats.Nat#`++`().
-Synthetics:
-[5:50..5:54):Succ => *.apply[Nat.this.type]
-[10:13..10:17):Succ => *.unapply[N$1]
-[20:11..20:15):Succ => *.unapply[N$2]
-
expect/semanticdb-Definitions.scala
-----------------------------------
```
</details>File tree
3 files changed
+111
-27
lines changed- compiler/src/dotty/tools/dotc/semanticdb
- tests/semanticdb
3 files changed
+111
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
225 | 231 | | |
226 | 232 | | |
227 | 233 | | |
| |||
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
| |||
0 commit comments