From 76a68cb00a345036e1b889ce1dba13c6326f4a8c Mon Sep 17 00:00:00 2001 From: rochala Date: Thu, 2 May 2024 10:53:34 +0200 Subject: [PATCH] Add regression test for issue 18726, release flag is ignored in completions --- .../completion/CompletionRelease11Suite.scala | 26 +++++++++++++++++++ .../completion/CompletionRelease8Suite.scala | 25 ++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease11Suite.scala create mode 100644 presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease8Suite.scala diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease11Suite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease11Suite.scala new file mode 100644 index 000000000000..72192bfb5a00 --- /dev/null +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease11Suite.scala @@ -0,0 +1,26 @@ +package dotty.tools.pc.tests.completion + +import dotty.tools.pc.base.BaseCompletionSuite + +import org.junit.Test +import java.nio.file.Path + +class CompletionRelease11Suite extends BaseCompletionSuite: + + override protected def scalacOptions(classpath: Seq[Path]): Seq[String] = + "-release:11" +: super.scalacOptions(classpath) + + @Test def java11Symbols = + check( + """ + |object A { + | "".repea@@ + |}""".stripMargin, + """repeat(x$0: Int): String + |replaceAll(x$0: String, x$1: String): String + |prependedAll[B >: A](prefix: IterableOnce[B]): IndexedSeq[B] + |prependedAll(prefix: String): String + |prependedAll[B >: Char](prefix: IterableOnce[B]): IndexedSeq[B] + |replaceAllLiterally(literal: String, replacement: String): String + |""".stripMargin + ) diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease8Suite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease8Suite.scala new file mode 100644 index 000000000000..ff10a28e1265 --- /dev/null +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionRelease8Suite.scala @@ -0,0 +1,25 @@ +package dotty.tools.pc.tests.completion + +import dotty.tools.pc.base.BaseCompletionSuite + +import org.junit.Test +import java.nio.file.Path + +class CompletionRelease8Suite extends BaseCompletionSuite: + + override protected def scalacOptions(classpath: Seq[Path]): Seq[String] = + "-release:8" +: super.scalacOptions(classpath) + + @Test def noJvm11Symbols = + check( + """ + |object A { + | "".repea@@ + |}""".stripMargin, + """replaceAll(x$0: String, x$1: String): String + |prependedAll[B >: A](prefix: IterableOnce[B]): IndexedSeq[B] + |prependedAll(prefix: String): String + |prependedAll[B >: Char](prefix: IterableOnce[B]): IndexedSeq[B] + |replaceAllLiterally(literal: String, replacement: String): String + |""".stripMargin + )