diff --git a/bin/test-release.sh b/bin/test-release.sh index 6469d3e6827..d540e1f0b0d 100755 --- a/bin/test-release.sh +++ b/bin/test-release.sh @@ -26,6 +26,7 @@ coursier fetch \ org.scalameta:mtags_2.13.8:$version \ 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.12.9:$version \ org.scalameta:mtags_2.12.10:$version \ org.scalameta:mtags_2.12.11:$version \ diff --git a/build.sbt b/build.sbt index 4b27cc583ae..8a09c52ec6c 100644 --- a/build.sbt +++ b/build.sbt @@ -339,9 +339,10 @@ val mtagsSettings = List( val current = (Compile / unmanagedSourceDirectories).value val base = (Compile / sourceDirectory).value val regex = "(\\d+)\\.(\\d+)\\.(\\d+).*".r - // For scala 2.13.9/10 we need to have a special Compat.scala + // 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 - if (scalaVersion.value == "2.13.9" || scalaVersion.value == "2.13.10") + val scalaVersionsWithSpecialCompat = Set("2.13.9", "2.13.10", "2.13.11") + if (scalaVersionsWithSpecialCompat(scalaVersion.value)) current.filter(f => f.getName() != "scala-2.13") else current diff --git a/metals/src/main/scala/scala/meta/internal/metals/MetalsLspService.scala b/metals/src/main/scala/scala/meta/internal/metals/MetalsLspService.scala index 7c26ee598d0..bbbc952e5c8 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/MetalsLspService.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/MetalsLspService.scala @@ -1746,7 +1746,7 @@ class MetalsLspService( override def completionItemResolve( item: CompletionItem ): CompletableFuture[CompletionItem] = - CancelTokens.future { token => + CancelTokens.future { _ => if (clientConfig.isCompletionItemResolve) { compilers.completionItemResolve(item) } else { @@ -1784,7 +1784,7 @@ class MetalsLspService( override def foldingRange( params: FoldingRangeRequestParams ): CompletableFuture[util.List[FoldingRange]] = { - CancelTokens.future { token => + CancelTokens.future { _ => val path = params.getTextDocument().getUri().toAbsolutePath if (path.isScala) parseTrees.currentFuture.map(_ => 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 5d96ede297e..7709d4fd9bd 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/MtagsResolver.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/MtagsResolver.scala @@ -48,6 +48,7 @@ object MtagsResolver { private val removedScalaVersions = Map( "2.13.1" -> "0.11.10", "2.13.2" -> "0.11.10", + "2.13.3" -> "0.11.12", "2.12.9" -> "0.11.10", "3.0.0" -> "0.11.10", "3.0.1" -> "0.11.10", diff --git a/mtags/src/main/scala-2.13.11/meta/internal/pc/Compat.scala b/mtags/src/main/scala-2.13.11/meta/internal/pc/Compat.scala new file mode 100644 index 00000000000..a4eeed4b00c --- /dev/null +++ b/mtags/src/main/scala-2.13.11/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 4bd35d495c0..15072fa846a 100644 --- a/project/V.scala +++ b/project/V.scala @@ -3,10 +3,10 @@ import sbt._ object V { val scala210 = "2.10.7" val scala211 = "2.11.12" - val scala212 = "2.12.17" - val scala213 = "2.13.10" - val scala3 = "3.2.2" - val scala3RC: Option[String] = Some("3.3.0-RC4") + val scala212 = "2.12.18" + val scala213 = "2.13.11" + val scala3 = "3.3.0" + val scala3RC: Option[String] = Some("3.3.1-RC1") val sbtScala = "2.12.16" val ammonite212Version = "2.12.17" val ammonite213Version = "2.13.10" @@ -71,6 +71,7 @@ object V { "2.12.12", "2.12.13", "2.13.3", + "2.12.14", "2.13.4", "2.13.5", "2.13.6", @@ -85,6 +86,7 @@ object V { "2.13.7", "2.13.8", "2.13.9", + "2.13.10", ) def scala2Versions = nonDeprecatedScala2Versions ++ deprecatedScala2Versions diff --git a/tests/cross/src/test/scala/tests/pc/CompletionDocSuite.scala b/tests/cross/src/test/scala/tests/pc/CompletionDocSuite.scala index afd6d273027..0ab5cbdb32a 100644 --- a/tests/cross/src/test/scala/tests/pc/CompletionDocSuite.scala +++ b/tests/cross/src/test/scala/tests/pc/CompletionDocSuite.scala @@ -561,6 +561,31 @@ class CompletionDocSuite extends BaseCompletionSuite { |StringBuilder(capacity: Int): StringBuilder |StringBuilder(initCapacity: Int, initValue: String): StringBuilder |""".stripMargin, + "2.13.11" -> + """|> A builder of `String` which is also a mutable sequence of characters. + | + | This class provides an API mostly compatible with `java.lang.StringBuilder`, + | except where there are conflicts with the Scala collections API, such as the `reverse` method: + | [reverse](reverse) produces a new `StringBuilder`, and [reverseInPlace](reverseInPlace) mutates this builder. + | + | Mutating operations return either `this.type`, i.e., the current builder, or `Unit`. + | + | Other methods extract data or information from the builder without mutating it. + | + | The distinction is also reflected in naming conventions used by collections, + | such as `append`, which mutates, and `appended`, which does not, or `reverse`, + | which does not mutate, and `reverseInPlace`, which does. + | + | The `String` result may be obtained using either `result()` or `toString`. + | + | $multipleResults + | + | + |**See** + |- ["Scala's Collection Library overview"](https://docs.scala-lang.org/overviews/collections-2.13/concrete-mutable-collection-classes.html#stringbuilders) + | section on `StringBuilders` for more information. + |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 87716ec0cf9..ba2e62d8b41 100644 --- a/tests/cross/src/test/scala/tests/pc/CompletionScalaCliSuite.scala +++ b/tests/cross/src/test/scala/tests/pc/CompletionScalaCliSuite.scala @@ -89,7 +89,7 @@ class CompletionScalaCliSuite extends BaseCompletionSuite { check( "plugin".tag( IgnoreScalaVersion(version => - Set("2.12.18")(version) || + Set("2.12.16", "2.12.18", "2.13.11")(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 7e59eb31f3e..d977de454df 100644 --- a/tests/cross/src/test/scala/tests/pc/CompletionSuite.scala +++ b/tests/cross/src/test/scala/tests/pc/CompletionSuite.scala @@ -1258,6 +1258,15 @@ class CompletionSuite extends BaseCompletionSuite { |implicitConversions scala.languageFeature |""".stripMargin, topLines = Some(5), + compat = Map( + "2.13.11" -> + """|dynamics scala.languageFeature + |existentials scala.languageFeature + |experimental scala.languageFeature + |implicitConversions scala.languageFeature + |postfixOps scala.languageFeature + |""".stripMargin + ), ) check( diff --git a/tests/cross/src/test/scala/tests/pc/SignatureHelpDocSuite.scala b/tests/cross/src/test/scala/tests/pc/SignatureHelpDocSuite.scala index 00b9d32514f..ea979ef2d77 100644 --- a/tests/cross/src/test/scala/tests/pc/SignatureHelpDocSuite.scala +++ b/tests/cross/src/test/scala/tests/pc/SignatureHelpDocSuite.scala @@ -1,6 +1,7 @@ package tests.pc import tests.BaseSignatureHelpSuite +import scala.meta.internal.mtags.BuildInfo class SignatureHelpDocSuite extends BaseSignatureHelpSuite { @@ -132,6 +133,8 @@ class SignatureHelpDocSuite extends BaseSignatureHelpSuite { |""".stripMargin, ), ) + + val addedSpace = if (BuildInfo.scalaCompilerVersion == "2.13.11") "" else " " checkDoc( "curry3", """ @@ -171,31 +174,31 @@ class SignatureHelpDocSuite extends BaseSignatureHelpSuite { |""".stripMargin, compat = Map( "2.13" -> - """|Applies a binary operator to a start value and all elements of this collection, - | going left to right. - | - | Note: will not terminate for infinite-sized collections. - | Note: might return different results for different runs, unless the - |underlying collection type is ordered or the operator is associative - |and commutative. - | - | - |**Type Parameters** - |- `B`: the result type of the binary operator. - | - |**Parameters** - |- `z`: the start value. - |- `op`: the binary operator. - | - |**Returns:** the result of inserting `op` between consecutive elements of this collection, - | going left to right with the start value `z` on the left: - | `op(...op(z, x), x, ..., x)` where `x, ..., x` - | are the elements of this collection. - | Returns `z` if this collection is empty. - |foldLeft[B](z: B)(op: (B, Int) => B): B - | ^^^^^^^^^^^^^^^^^ - | @param op (Int, Int) => Int - |""".stripMargin, + s"""|Applies a binary operator to a start value and all elements of this collection, + | going left to right. + | + | Note: will not terminate for infinite-sized collections. + | Note: might return different results for different runs, unless the + |underlying collection type is ordered or the operator is associative + |and commutative. + | + | + |**Type Parameters** + |- `B`: the result type of the binary operator. + | + |**Parameters** + |- `z`: the start value. + |- `op`: the binary operator. + | + |**Returns:** the result of inserting `op` between consecutive elements of this collection, + | going left to right with the start value `z` on the left: + | `op(...op(z, x), x, ..., x)` where `x, ..., x` + | ${addedSpace}are the elements of this collection. + | Returns `z` if this collection is empty. + |foldLeft[B](z: B)(op: (B, Int) => B): B + | ^^^^^^^^^^^^^^^^^ + | @param op (Int, Int) => Int + |""".stripMargin, "3" -> """|Applies a binary operator to a start value and all elements of this collection, | going left to right.