From a32e14a833072fd8a5fff4f3242a23f3c4e6e793 Mon Sep 17 00:00:00 2001 From: Jan Chyb Date: Fri, 12 Jan 2024 10:57:22 +0100 Subject: [PATCH] Fix a completion test failing on java 8 [Cherry-picked 8d1d4131194f53cea65bad31a8f14bf7929a608c] --- .../completion/CompletionSnippetSuite.scala | 73 +++++++++++++------ 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSnippetSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSnippetSuite.scala index 46e0fe7b1976..3091ddc32b3a 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSnippetSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSnippetSuite.scala @@ -77,31 +77,62 @@ class CompletionSnippetSuite extends BaseCompletionSuite: // Dotty does not currently support fuzzy completions. Please take a look at // https://github.com/lampepfl/dotty-feature-requests/issues/314 @Test def `type-empty` = - checkSnippet( - """ - |object Main { - | type MyType = List[Int] - | def list : MT@@ - |} - |""".stripMargin, - """|MyType - |""".stripMargin - ) + if (scala.util.Properties.isJavaAtLeast("9")) { + checkSnippet( + """ + |object Main { + | type MyType = List[Int] + | def list : MT@@ + |} + |""".stripMargin, + """|MyType + |""".stripMargin + ) + } else { + checkSnippet( + """ + |object Main { + | type MyType = List[Int] + | def list : MT@@ + |} + |""".stripMargin, + """|MyType + |MTOM + |MTOMFeature + |""".stripMargin + ) + } // Dotty does not currently support fuzzy completions. Please take a look at // https://github.com/lampepfl/dotty-feature-requests/issues/314 @Test def `type-new-empty` = - checkSnippet( - """ - |object Main { - | class Gen[T] - | type MyType = Gen[Int] - | new MT@@ - |} - |""".stripMargin, - """|MyType - |""".stripMargin - ) + if (scala.util.Properties.isJavaAtLeast("9")) { + checkSnippet( + """ + |object Main { + | class Gen[T] + | type MyType = Gen[Int] + | new MT@@ + |} + |""".stripMargin, + """|MyType + |""".stripMargin + ) + } else { + checkSnippet( + """ + |object Main { + | class Gen[T] + | type MyType = Gen[Int] + | new MT@@ + |} + |""".stripMargin, + """|MyType + |MTOM + |MTOMFeature + |""".stripMargin + ) + } @Test def `type` = checkSnippet(