Commit b82dabc
Fix issue with pc breaking in requiredMethod on newly overloaded valueOf (scala#23708)
We recently started having issues when running completions in metals,
with the presentation compiler crashing:
```scala
dotty.tools.dotc.core.TypeError$.apply(TypeErrors.scala:54)
dotty.tools.dotc.core.Denotations$MultiDenotation.suchThat(Denotations.scala:1280)
dotty.tools.dotc.core.Denotations$Denotation.requiredSymbol(Denotations.scala:305)
dotty.tools.dotc.core.Denotations$Denotation.requiredMethod(Denotations.scala:321)
dotty.tools.pc.completions.Completions.isUninterestingSymbol$lzyINIT1(Completions.scala:744)
dotty.tools.pc.completions.Completions.isUninterestingSymbol(Completions.scala:725)
dotty.tools.pc.completions.Completions.includeSymbol(Completions.scala:90)
dotty.tools.pc.completions.Completions.visit$3(Completions.scala:697)
dotty.tools.pc.completions.Completions.filterInteresting$$anonfun$1(Completions.scala:715)
scala.collection.immutable.List.foreach(List.scala:334)
dotty.tools.pc.completions.Completions.filterInteresting(Completions.scala:715)
dotty.tools.pc.completions.Completions.enrichedCompilerCompletions(Completions.scala:118)
dotty.tools.pc.completions.Completions.completions(Completions.scala:136)
dotty.tools.pc.completions.CompletionProvider.completions(CompletionProvider.scala:139)
dotty.tools.pc.ScalaPresentationCompiler.complete$$anonfun$1(ScalaPresentationCompiler.scala:194)
dotty.tools.dotc.core.TypeError$$anon$1: Failure to disambiguate overloaded reference with
method valueOf in object Predef: [T]: T and
method valueOf in object Predef: [T](implicit vt: ValueOf[T]): T
```
This happened after the recent changes to the stdlib, with the, I
believe, newly added valueOf overload, and the previously used
`requiredMethod` by design not handling these cases.
I also noticed that in the same piece of code we had a bit of an empty
Symbol factory situation going on, with MultiDenotation being changed
into a Symbol (always resulting in an empty symbol), and only later
flattened with the `alternatives`, so I changed that too.
I can't really test this properly, as the pc tests seem to use an older
stdlib, but at least the `wait` methods do resolve properly after these
changes, so I have no reason to think the valueOf methods would be any
different.
[Cherry-picked 1b5e93b]1 parent 0cc52d0 commit b82dabc
File tree
2 files changed
+7
-7
lines changed- presentation-compiler
- src/main/dotty/tools/pc/completions
- test/dotty/tools/pc/tests/completion
2 files changed
+7
-7
lines changedLines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
736 | 736 | | |
737 | 737 | | |
738 | 738 | | |
739 | | - | |
740 | 739 | | |
741 | 740 | | |
742 | 741 | | |
743 | 742 | | |
744 | 743 | | |
745 | | - | |
746 | | - | |
747 | | - | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
748 | 751 | | |
749 | 752 | | |
750 | 753 | | |
| |||
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | 131 | | |
135 | 132 | | |
136 | 133 | | |
| |||
0 commit comments