From bc7c848522c97f4309742c98e77940cd718aaa5e Mon Sep 17 00:00:00 2001 From: rochala Date: Fri, 12 Apr 2024 11:04:32 +0200 Subject: [PATCH] Don't show extra applies for non-type-forwarder vals --- .../src/main/dotty/tools/pc/completions/Completions.scala | 4 +++- .../dotty/tools/pc/tests/completion/CompletionDocSuite.scala | 3 +-- .../dotty/tools/pc/tests/completion/CompletionSuite.scala | 3 +-- .../tools/pc/tests/completion/CompletionWorkspaceSuite.scala | 1 - 4 files changed, 5 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 3bb869782e14..7a10c9e4804d 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/Completions.scala @@ -238,7 +238,9 @@ class Completions( .filter(_.symbol.isAccessibleFrom(denot.info)) constructors -> true - else if shouldAddSnippet && completionMode.is(Mode.Term) && sym.name.isTermName && !sym.is(Flags.Method) && !sym.is(Flags.JavaDefined) then + else if shouldAddSnippet && completionMode.is(Mode.Term) && sym.name.isTermName && + !sym.is(Flags.JavaDefined) && (sym.isClass || sym.is(Module) || (sym.isField && denot.info.isInstanceOf[TermRef])) then + val constructors = if sym.isAllOf(ConstructorProxyModule) then sym.companionClass.info.member(nme.CONSTRUCTOR).allSymbols else diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionDocSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionDocSuite.scala index 86a65dd9ea41..b487611b9ea1 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionDocSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionDocSuite.scala @@ -305,7 +305,6 @@ class CompletionDocSuite extends BaseCompletionSuite: | } |} """.stripMargin, - """|myNumbers(i: Int): Int - |myNumbers: Vector[Int] + """|myNumbers: Vector[Int] |""".stripMargin ) 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 38b689ff6bdb..ebca80dc0717 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala @@ -1627,8 +1627,7 @@ class CompletionSuite extends BaseCompletionSuite: | val fooBar = List(123) | foo@@ |""".stripMargin, - """|fooBar(n: Int): Int - |fooBar: List[Int] + """|fooBar: List[Int] |""".stripMargin ) diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionWorkspaceSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionWorkspaceSuite.scala index 4cae717a7d26..c8cfbd178f32 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionWorkspaceSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionWorkspaceSuite.scala @@ -810,7 +810,6 @@ class CompletionWorkspaceSuite extends BaseCompletionSuite: |} |""".stripMargin, """|fooBar: String - |fooBar(n: Int): Int - test.A |fooBar: List[Int] |""".stripMargin, )