From 5ad8596c21c6875a7b411025f1afddc46f6e2430 Mon Sep 17 00:00:00 2001 From: tgodzik Date: Wed, 6 Sep 2023 23:24:07 +0200 Subject: [PATCH] chore: Add support for Scala 2.13.12 --- bin/test-release.sh | 2 ++ build.sbt | 3 ++- .../meta/internal/metals/MtagsResolver.scala | 1 + .../meta/internal/pc/Compat.scala | 26 +++++++++++++++++++ project/V.scala | 6 ++--- .../scala/tests/pc/CompletionDocSuite.scala | 4 +++ .../tests/pc/CompletionScalaCliSuite.scala | 2 +- .../test/scala/tests/pc/CompletionSuite.scala | 7 +++++ .../tests/pc/SignatureHelpDocSuite.scala | 2 +- .../scala/tests/DiagnosticsLspSuite.scala | 4 +-- .../scala/tests/SemanticTokensLspSuite.scala | 2 +- .../ImplementAbstractMembersLspSuite.scala | 2 +- 12 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 mtags/src/main/scala-2.13.12/meta/internal/pc/Compat.scala diff --git a/bin/test-release.sh b/bin/test-release.sh index 70f4cbf961f..84e8b69c935 100755 --- a/bin/test-release.sh +++ b/bin/test-release.sh @@ -15,6 +15,7 @@ coursier fetch \ org.scalameta:mtags_3.2.1:$version \ org.scalameta:mtags_3.2.2:$version \ org.scalameta:mtags_3.3.0:$version \ + org.scalameta:mtags_3.3.1:$version \ org.scalameta:mtags_2.13.4:$version \ org.scalameta:mtags_2.13.5:$version \ org.scalameta:mtags_2.13.6:$version \ @@ -23,6 +24,7 @@ coursier fetch \ org.scalameta:mtags_2.13.9:$version \ org.scalameta:mtags_2.13.10:$version \ org.scalameta:mtags_2.13.11:$version \ + org.scalameta:mtags_2.13.12:$version \ org.scalameta:mtags_2.12.11:$version \ org.scalameta:mtags_2.12.12:$version \ org.scalameta:mtags_2.12.13:$version \ diff --git a/build.sbt b/build.sbt index b1dd5750dfe..607dfef4028 100644 --- a/build.sbt +++ b/build.sbt @@ -350,7 +350,8 @@ val mtagsSettings = List( val regex = "(\\d+)\\.(\\d+)\\.(\\d+).*".r // For scala +2.13.9 we need to have a special Compat.scala // For this case filter out `scala-2.13` directory that comes by default - val scalaVersionsWithSpecialCompat = Set("2.13.9", "2.13.10", "2.13.11") + val scalaVersionsWithSpecialCompat = + Set("2.13.9", "2.13.10", "2.13.11", "2.13.12") if (scalaVersionsWithSpecialCompat(scalaVersion.value)) current.filter(f => f.getName() != "scala-2.13") else if (isScala3WithPresentationCompiler(scalaVersion.value)) diff --git a/metals/src/main/scala/scala/meta/internal/metals/MtagsResolver.scala b/metals/src/main/scala/scala/meta/internal/metals/MtagsResolver.scala index 8ea0a048621..c7ff1f7ef00 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/MtagsResolver.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/MtagsResolver.scala @@ -49,6 +49,7 @@ object MtagsResolver { "2.13.1" -> "0.11.10", "2.13.2" -> "0.11.10", "2.13.3" -> "0.11.12", + "2.13.4" -> "1.0.1", "2.12.9" -> "0.11.10", "2.12.10" -> "0.11.12", "3.0.0" -> "0.11.10", diff --git a/mtags/src/main/scala-2.13.12/meta/internal/pc/Compat.scala b/mtags/src/main/scala-2.13.12/meta/internal/pc/Compat.scala new file mode 100644 index 00000000000..a4eeed4b00c --- /dev/null +++ b/mtags/src/main/scala-2.13.12/meta/internal/pc/Compat.scala @@ -0,0 +1,26 @@ +package scala.meta.internal.pc + +import scala.reflect.internal.Reporter +import scala.tools.nsc.reporters.StoreReporter + +trait Compat { this: MetalsGlobal => + def metalsFunctionArgTypes(tpe: Type): List[Type] = + definitions.functionOrPfOrSamArgTypes(tpe) + + val AssignOrNamedArg: NamedArgExtractor = NamedArg + + def storeReporter(r: Reporter): Option[StoreReporter] = + r match { + case s: StoreReporter => Some(s) + case _ => None + } + + def isAliasCompletion(m: Member): Boolean = m match { + case tm: TypeMember => tm.aliasInfo.nonEmpty + case sm: ScopeMember => sm.aliasInfo.nonEmpty + case _ => false + } + + def constantType(c: ConstantType): ConstantType = + if (c.value.isSuitableLiteralType) LiteralType(c.value) else c +} diff --git a/project/V.scala b/project/V.scala index d9bb91c112a..e59b5012ad1 100644 --- a/project/V.scala +++ b/project/V.scala @@ -4,7 +4,7 @@ object V { val scala210 = "2.10.7" val scala211 = "2.11.12" val scala212 = "2.12.18" - val scala213 = "2.13.11" + val scala213 = "2.13.12" val scala3 = "3.3.1" val firstScala3PCVersion = "3.3.2-RC1-bin-20230721-492f777-NIGHTLY" // When you can add to removedScalaVersions in MtagsResolver.scala with the last released version @@ -73,10 +73,10 @@ object V { "2.12.12", "2.12.13", "2.12.14", - "2.13.4", "2.13.5", "2.13.6", "2.13.7", + "2.13.8", ) def nonDeprecatedScala2Versions = Seq( @@ -85,9 +85,9 @@ object V { "2.12.17", "2.12.16", "2.12.15", - "2.13.8", "2.13.9", "2.13.10", + "2.13.11", ) def minimumSupportedSbtVersion = { diff --git a/tests/cross/src/test/scala/tests/pc/CompletionDocSuite.scala b/tests/cross/src/test/scala/tests/pc/CompletionDocSuite.scala index c068814eeee..0c8a04a3325 100644 --- a/tests/cross/src/test/scala/tests/pc/CompletionDocSuite.scala +++ b/tests/cross/src/test/scala/tests/pc/CompletionDocSuite.scala @@ -594,6 +594,10 @@ class CompletionDocSuite extends BaseCompletionSuite { s"""|$scala213Docs |StringBuilder scala.collection.mutable |""".stripMargin, + "2.13.12" -> + s"""|$scala213Docs + |StringBuilder scala.collection.mutable + |""".stripMargin, ), ) diff --git a/tests/cross/src/test/scala/tests/pc/CompletionScalaCliSuite.scala b/tests/cross/src/test/scala/tests/pc/CompletionScalaCliSuite.scala index 6d8f8983e28..245e8bf9b04 100644 --- a/tests/cross/src/test/scala/tests/pc/CompletionScalaCliSuite.scala +++ b/tests/cross/src/test/scala/tests/pc/CompletionScalaCliSuite.scala @@ -100,7 +100,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite { check( "plugin".tag( IgnoreScalaVersion(version => - Set("2.12.16", "3.3.1")(version) || + Set("2.12.16", "2.13.12", "3.3.1")(version) || version.contains( "NIGHTLY" ) || version.contains( diff --git a/tests/cross/src/test/scala/tests/pc/CompletionSuite.scala b/tests/cross/src/test/scala/tests/pc/CompletionSuite.scala index 163a3cc62e8..d549bc3c447 100644 --- a/tests/cross/src/test/scala/tests/pc/CompletionSuite.scala +++ b/tests/cross/src/test/scala/tests/pc/CompletionSuite.scala @@ -1281,6 +1281,13 @@ class CompletionSuite extends BaseCompletionSuite { |implicitConversions scala.languageFeature |postfixOps scala.languageFeature |""".stripMargin, + "2.13.12" -> + """|dynamics scala.languageFeature + |existentials scala.languageFeature + |experimental scala.languageFeature + |implicitConversions scala.languageFeature + |postfixOps scala.languageFeature + |""".stripMargin, scala3PresentationCompilerVersion -> """|dynamics scala.languageFeature |existentials scala.languageFeature diff --git a/tests/cross/src/test/scala/tests/pc/SignatureHelpDocSuite.scala b/tests/cross/src/test/scala/tests/pc/SignatureHelpDocSuite.scala index 51df3890f2a..f8e9e088fb9 100644 --- a/tests/cross/src/test/scala/tests/pc/SignatureHelpDocSuite.scala +++ b/tests/cross/src/test/scala/tests/pc/SignatureHelpDocSuite.scala @@ -96,7 +96,7 @@ class SignatureHelpDocSuite extends BaseSignatureHelpSuite { ) val addedSpace: String = - if (BuildInfo.scalaCompilerVersion == "2.13.11") "" else " " + if (Set("2.13.11", "2.13.12")(BuildInfo.scalaCompilerVersion)) "" else " " checkDoc( "curry3", """ diff --git a/tests/unit/src/test/scala/tests/DiagnosticsLspSuite.scala b/tests/unit/src/test/scala/tests/DiagnosticsLspSuite.scala index a673094efd9..035321e8b65 100644 --- a/tests/unit/src/test/scala/tests/DiagnosticsLspSuite.scala +++ b/tests/unit/src/test/scala/tests/DiagnosticsLspSuite.scala @@ -149,12 +149,12 @@ class DiagnosticsLspSuite extends BaseLspSuite("diagnostics") { _ <- server.didOpen("a/src/main/scala/a/Post.scala") _ = assertNoDiff( client.workspaceDiagnostics, - """|a/src/main/scala/a/Post.scala:5:1: error: object creation impossible. + """|a/src/main/scala/a/Post.scala:5:8: error: object creation impossible. |Missing implementation for member of trait Post: | def post: Int = ??? | |object Post extends Post - |^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^ |""".stripMargin, ) } yield () diff --git a/tests/unit/src/test/scala/tests/SemanticTokensLspSuite.scala b/tests/unit/src/test/scala/tests/SemanticTokensLspSuite.scala index 3d204a6e644..93b5cb2b6b4 100644 --- a/tests/unit/src/test/scala/tests/SemanticTokensLspSuite.scala +++ b/tests/unit/src/test/scala/tests/SemanticTokensLspSuite.scala @@ -41,7 +41,7 @@ class SemanticTokensLspSuite extends BaseLspSuite("SemanticTokens") { |<>/*keyword*/ <
>/*class*/ { | <>/*keyword*/ <>/*variable,definition,readonly*/ = <>/*keyword*/ | <>/*keyword*/ <>/*variable,definition,readonly*/ = <>/*keyword*/ - | (<>/*keyword*/: <>/*enumMember,abstract*/) <>/*keyword*/ { + | (<>/*keyword*/: <>/*enumMember*/) <>/*keyword*/ { | <>/*keyword*/ <>/*enumMember*/ <<=>>>/*operator*/ <<0>>/*number*/ | <>/*keyword*/ <>/*enumMember*/ <<=>>>/*operator*/ | <>/*keyword*/ <>/*enumMember*/ <<=>>>/*operator*/ diff --git a/tests/unit/src/test/scala/tests/codeactions/ImplementAbstractMembersLspSuite.scala b/tests/unit/src/test/scala/tests/codeactions/ImplementAbstractMembersLspSuite.scala index d6f950c988e..9e5ff5d3bc2 100644 --- a/tests/unit/src/test/scala/tests/codeactions/ImplementAbstractMembersLspSuite.scala +++ b/tests/unit/src/test/scala/tests/codeactions/ImplementAbstractMembersLspSuite.scala @@ -279,7 +279,7 @@ class ImplementAbstractMembersLspSuite path, """|package a | - |object Impl extends <> + |<> |""".stripMargin, s"""|${ImplementAbstractMembers.title} |""".stripMargin,