From f1d21e36e21c91ca4dd67992a93752ec9abc15ff Mon Sep 17 00:00:00 2001 From: Jan Chyb Date: Mon, 11 Aug 2025 15:38:42 +0200 Subject: [PATCH 1/3] Fix issue with pc breaking in requiredMethod on newly overloaded valueOf --- .../dotty/tools/pc/completions/Completions.scala | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala index e7902ef8aa44..633178d4e85a 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala @@ -734,15 +734,18 @@ class Completions( defn.Object_notifyAll, defn.Object_notify, defn.Predef_undefined, - defn.ObjectClass.info.member(nme.wait_).symbol, // NOTE(olafur) IntelliJ does not complete the root package and without this filter // then `_root_` would appear as a completion result in the code `foobar(_)` defn.RootPackage, - // NOTE(gabro) valueOf was added as a Predef member in 2.13. We filter it out since is a niche - // use case and it would appear upon typing 'val' - defn.ValueOfClass.info.member(nme.valueOf).symbol, - defn.ScalaPredefModule.requiredMethod(nme.valueOf) - ).flatMap(_.alternatives.map(_.symbol)).toSet + ) ++ ( + Set( + defn.ObjectClass.info.member(nme.wait_), + // NOTE(gabro) valueOf was added as a Predef member in 2.13. We filter it out since is a niche + // use case and it would appear upon typing 'val' + defn.ValueOfClass.info.member(nme.valueOf), + defn.ScalaPredefModule.info.member(nme.valueOf) + ).flatMap(_.alternatives.map(_.symbol)).toSet + ) private def isNotLocalForwardReference(sym: Symbol)(using Context): Boolean = !sym.isLocalToBlock || From 64763fb0dbe374b42e597c6cbc8db50178a8dbaa Mon Sep 17 00:00:00 2001 From: Jan Chyb Date: Mon, 11 Aug 2025 15:59:33 +0200 Subject: [PATCH 2/3] Remove the nonexistent ValueOf.valueOf and add ValueOf to the completion filter --- .../src/main/dotty/tools/pc/completions/Completions.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala index 633178d4e85a..b396dd780cc0 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala @@ -737,12 +737,12 @@ class Completions( // NOTE(olafur) IntelliJ does not complete the root package and without this filter // then `_root_` would appear as a completion result in the code `foobar(_)` defn.RootPackage, + // NOTE(gabro) valueOf was added as a Predef member in 2.13. We filter it out since is a niche + // use case and it would appear upon typing 'val' + defn.ValueOfClass ) ++ ( Set( defn.ObjectClass.info.member(nme.wait_), - // NOTE(gabro) valueOf was added as a Predef member in 2.13. We filter it out since is a niche - // use case and it would appear upon typing 'val' - defn.ValueOfClass.info.member(nme.valueOf), defn.ScalaPredefModule.info.member(nme.valueOf) ).flatMap(_.alternatives.map(_.symbol)).toSet ) From a4d07aaa5dce33d7d59726942599e805fde9eefb Mon Sep 17 00:00:00 2001 From: Jan Chyb Date: Tue, 12 Aug 2025 11:41:43 +0200 Subject: [PATCH 3/3] fix test --- .../test/dotty/tools/pc/tests/completion/CompletionSuite.scala | 3 --- 1 file changed, 3 deletions(-) diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala index 05037cffca94..277a579ba4ce 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala @@ -129,9 +129,6 @@ class CompletionSuite extends BaseCompletionSuite: |isInstanceOf[X0]: Boolean |synchronized[X0](x$0: X0): X0 |toString(): String - |wait(): Unit - |wait(x$0: Long): Unit - |wait(x$0: Long, x$1: Int): Unit |""".stripMargin )