File tree Expand file tree Collapse file tree 5 files changed +77
-2
lines changed
compiler/src/dotty/tools/dotc/interactive Expand file tree Collapse file tree 5 files changed +77
-2
lines changed Original file line number Diff line number Diff line change @@ -284,7 +284,6 @@ object Completion:
284284 if denot.isType then denot.symbol.showFullName
285285 else denot.info.widenTermRefExpr.show
286286
287-
288287 def isInNewContext (untpdPath : List [untpd.Tree ]): Boolean =
289288 untpdPath match
290289 case _ :: untpd.New (selectOrIdent : (untpd.Select | untpd.Ident )) :: _ => true
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ case class ScalaPresentationCompiler(
6060 val scalaVersion = BuildInfo .scalaVersion
6161
6262 private val forbiddenOptions = Set (" -print-lines" , " -print-tasty" )
63- private val forbiddenDoubleOptions = Set ( " -release " )
63+ private val forbiddenDoubleOptions = Set .empty[ String ]
6464
6565 given ReportContext =
6666 folderPath
Original file line number Diff line number Diff line change 1+ package dotty .tools .pc .tests .completion
2+
3+ import dotty .tools .pc .base .BaseCompletionSuite
4+
5+ import org .junit .Test
6+ import org .junit .Before
7+ import java .nio .file .Path
8+ import dotty .tools .pc .utils .JRE
9+
10+ class CompletionRelease11Suite extends BaseCompletionSuite :
11+
12+ override protected def scalacOptions (classpath : Seq [Path ]): Seq [String ] =
13+ " -release:11" +: super .scalacOptions(classpath)
14+
15+ @ Before
16+ def beforeMethod (): Unit =
17+ org.junit.Assume .assumeTrue(JRE .getJavaMajorVersion >= 11 )
18+
19+ @ Test def java11Symbols =
20+ check(
21+ """
22+ |object A {
23+ | "".repea@@
24+ |}""" .stripMargin,
25+ """ repeat(x$0: Int): String
26+ |replaceAll(x$0: String, x$1: String): String
27+ |prependedAll[B >: A](prefix: IterableOnce[B]): IndexedSeq[B]
28+ |prependedAll(prefix: String): String
29+ |prependedAll[B >: Char](prefix: IterableOnce[B]): IndexedSeq[B]
30+ |replaceAllLiterally(literal: String, replacement: String): String
31+ |""" .stripMargin
32+ )
Original file line number Diff line number Diff line change 1+ package dotty .tools .pc .tests .completion
2+
3+ import dotty .tools .pc .base .BaseCompletionSuite
4+
5+ import org .junit .Test
6+ import org .junit .Before
7+ import java .nio .file .Path
8+ import dotty .tools .pc .utils .JRE
9+
10+ class CompletionRelease8Suite extends BaseCompletionSuite :
11+
12+ override protected def scalacOptions (classpath : Seq [Path ]): Seq [String ] =
13+ " -release:8" +: super .scalacOptions(classpath)
14+
15+ @ Before
16+ def beforeMethod (): Unit =
17+ org.junit.Assume .assumeTrue(JRE .getJavaMajorVersion >= 8 )
18+
19+ @ Test def noJvm11Symbols =
20+ check(
21+ """
22+ |object A {
23+ | "".repea@@
24+ |}""" .stripMargin,
25+ """ replaceAll(x$0: String, x$1: String): String
26+ |prependedAll[B >: A](prefix: IterableOnce[B]): IndexedSeq[B]
27+ |prependedAll(prefix: String): String
28+ |prependedAll[B >: Char](prefix: IterableOnce[B]): IndexedSeq[B]
29+ |replaceAllLiterally(literal: String, replacement: String): String
30+ |""" .stripMargin
31+ )
Original file line number Diff line number Diff line change 1+ package dotty .tools .pc .utils
2+
3+ object JRE :
4+
5+ def getJavaMajorVersion : Int =
6+ val javaVersion = sys.env.get(" java.specification.version" ).filter(! _.isEmpty())
7+
8+ javaVersion match
9+ case Some (version) if version.startsWith(" 1.8" ) => 8
10+ case Some (version) => version.toInt // it is better to crash during tests than to run incorrect suite
11+ case None => 8
12+
13+
You can’t perform that action at this time.
0 commit comments