Skip to content

Commit

Permalink
Add support for Scala 2.13.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Jun 26, 2020
1 parent ba810f2 commit 217faef
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 120 deletions.
11 changes: 7 additions & 4 deletions build.sbt
Expand Up @@ -162,8 +162,8 @@ lazy val V = new {
val scala210 = "2.10.7"
val scala211 = "2.11.12"
val scala212 = "2.12.11"
val scala213 = "2.13.2"
val scalameta = "4.3.15"
val scala213 = "2.13.3"
val scalameta = "4.3.17"
val semanticdb = scalameta
val bsp = "2.0.0-M4+10-61e61e87"
val bloop = "1.4.2"
Expand All @@ -186,7 +186,8 @@ lazy val V = new {

// Scala 2
def deprecatedScala2Versions = Seq(scala211, "2.12.8", "2.12.9", "2.13.0")
def nonDeprecatedScala2Versions = Seq(scala213, scala212, "2.12.10", "2.13.1")
def nonDeprecatedScala2Versions =
Seq(scala213, scala212, "2.12.10", "2.13.1", "2.13.2")
def scala2Versions = nonDeprecatedScala2Versions ++ deprecatedScala2Versions

// Scala 3
Expand Down Expand Up @@ -513,7 +514,9 @@ def publishBinaryMtags =
publishLocal
.in(interfaces)
.dependsOn(
publishAllMtags(List(V.scala211, V.scala212, V.scala213, V.scala3))
publishAllMtags(
List(V.scala211, V.scala212, V.scala213, "2.13.2", V.scala3)
)
)

lazy val mtest = project
Expand Down
Expand Up @@ -7,11 +7,8 @@ import scala.collection.immutable.Nil
import scala.util.control.NonFatal

import scala.meta.internal.pc.CompletionFuzzy
import scala.meta.internal.pc.CompletionFuzzy
import scala.meta.internal.pc.MetalsGlobal
import scala.meta.internal.pc.MetalsGlobal

import org.eclipse.{lsp4j => l}
import org.eclipse.{lsp4j => l}

trait FilenameCompletions { this: MetalsGlobal =>
Expand Down
229 changes: 119 additions & 110 deletions tests/cross/src/test/scala/tests/pc/CompletionDocSuite.scala
Expand Up @@ -213,6 +213,91 @@ class CompletionDocSuite extends BaseCompletionSuite {
|""".stripMargin
)
)

val iteratorDocs213: String =
"""|> Iterators are data structures that allow to iterate over a sequence
|of elements. They have a `hasNext` method for checking
|if there is a next element available, and a `next` method
|which returns the next element and advances the iterator.
|
|An iterator is mutable: most operations on it change its state. While it is often used
|to iterate through the elements of a collection, it can also be used without
|being backed by any collection (see constructors on the companion object).
|
|It is of particular importance to note that, unless stated otherwise, *one should never
|use an iterator after calling a method on it*. The two most important exceptions
|are also the sole abstract methods: `next` and `hasNext`.
|
|Both these methods can be called any number of times without having to discard the
|iterator. Note that even `hasNext` may cause mutation -- such as when iterating
|from an input stream, where it will block until the stream is closed or some
|input becomes available.
|
|Consider this example for safe and unsafe use:
|
|```
|def f[A](it: Iterator[A]) = {
| if (it.hasNext) { // Safe to reuse "it" after "hasNext"
| it.next // Safe to reuse "it" after "next"
| val remainder = it.drop(2) // it is *not* safe to use "it" again after this line!
| remainder.take(2) // it is *not* safe to use "remainder" after this line!
| } else it
|}
|```
|Iterator scala.collection
|> Explicit instantiation of the `Iterator` trait to reduce class file size in subclasses.
|AbstractIterator scala.collection
|> Buffered iterators are iterators which provide a method `head`
| that inspects the next element without discarding it.
|BufferedIterator scala.collection
|> A specialized Iterator for LinearSeqs that is lazy enough for Stream and LazyList. This is accomplished by not
|evaluating the tail after returning the current head.
|LinearSeqIterator scala.collection
|> Base trait for companion objects of collections that require an implicit `ClassTag`.
|
|**Type Parameters**
|- `CC`: Collection type constructor (e.g. `ArraySeq`)
|ClassTagIterableFactory scala.collection
|> Base trait for companion objects of collections that require an implicit evidence.
|
|**Type Parameters**
|- `Ev`: Unary type constructor for the implicit evidence required for an element type
| (typically `Ordering` or `ClassTag`)
|- `CC`: Collection type constructor (e.g. `ArraySeq`)
|EvidenceIterableFactory scala.collection
|> This trait provides default implementations for the factory methods `fromSpecific` and
|`newSpecificBuilder` that need to be refined when implementing a collection type that refines
|the `CC` and `C` type parameters. It is used for collections that have an additional constraint,
|expressed by the `evidenceIterableFactory` method.
|
|The default implementations in this trait can be used in the common case when `CC[A]` is the
|same as `C`.
|EvidenceIterableFactoryDefaults scala.collection
|> Base trait for companion objects of unconstrained collection types that may require
|multiple traversals of a source collection to build a target collection `CC`.
|
|
|**Type Parameters**
|- `CC`: Collection type constructor (e.g. `List`)
|IterableFactory scala.collection
|> This trait provides default implementations for the factory methods `fromSpecific` and
|`newSpecificBuilder` that need to be refined when implementing a collection type that refines
|the `CC` and `C` type parameters.
|
|The default implementations in this trait can be used in the common case when `CC[A]` is the
|same as `C`.
|IterableFactoryDefaults scala.collection
|> Base trait for companion objects of collections that require an implicit `Ordering`.
|
|**Type Parameters**
|- `CC`: Collection type constructor (e.g. `SortedSet`)
|SortedIterableFactory scala.collection
|> **Type Parameters**
|- `A`: Type of elements (e.g. `Int`, `Boolean`, etc.)
|- `C`: Type of collection (e.g. `List[Int]`, `TreeMap[Int, String]`, etc.)
|SpecificIterableFactory scala.collection
|""".stripMargin

check(
"scala4",
"""
Expand Down Expand Up @@ -263,89 +348,9 @@ class CompletionDocSuite extends BaseCompletionSuite {
|""".stripMargin,
includeDocs = true,
compat = Map(
"2.13" ->
"""|> Iterators are data structures that allow to iterate over a sequence
|of elements. They have a `hasNext` method for checking
|if there is a next element available, and a `next` method
|which returns the next element and advances the iterator.
|
|An iterator is mutable: most operations on it change its state. While it is often used
|to iterate through the elements of a collection, it can also be used without
|being backed by any collection (see constructors on the companion object).
|
|It is of particular importance to note that, unless stated otherwise, *one should never
|use an iterator after calling a method on it*. The two most important exceptions
|are also the sole abstract methods: `next` and `hasNext`.
|
|Both these methods can be called any number of times without having to discard the
|iterator. Note that even `hasNext` may cause mutation -- such as when iterating
|from an input stream, where it will block until the stream is closed or some
|input becomes available.
|
|Consider this example for safe and unsafe use:
|
|```
|def f[A](it: Iterator[A]) = {
| if (it.hasNext) { // Safe to reuse "it" after "hasNext"
| it.next // Safe to reuse "it" after "next"
| val remainder = it.drop(2) // it is *not* safe to use "it" again after this line!
| remainder.take(2) // it is *not* safe to use "remainder" after this line!
| } else it
|}
|```
|Iterator scala.collection
|> Explicit instantiation of the `Iterator` trait to reduce class file size in subclasses.
|AbstractIterator scala.collection
|> Buffered iterators are iterators which provide a method `head`
| that inspects the next element without discarding it.
|BufferedIterator scala.collection
|> A specialized Iterator for LinearSeqs that is lazy enough for Stream and LazyList. This is accomplished by not
|evaluating the tail after returning the current head.
|LinearSeqIterator scala.collection
|> Base trait for companion objects of collections that require an implicit `ClassTag`.
|
|**Type Parameters**
|- `CC`: Collection type constructor (e.g. `ArraySeq`)
|ClassTagIterableFactory scala.collection
|> Base trait for companion objects of collections that require an implicit evidence.
|
|**Type Parameters**
|- `Ev`: Unary type constructor for the implicit evidence required for an element type
| (typically `Ordering` or `ClassTag`)
|- `CC`: Collection type constructor (e.g. `ArraySeq`)
|EvidenceIterableFactory scala.collection
|> This trait provides default implementations for the factory methods `fromSpecific` and
|`newSpecificBuilder` that need to be refined when implementing a collection type that refines
|the `CC` and `C` type parameters. It is used for collections that have an additional constraint,
|expressed by the `evidenceIterableFactory` method.
|
|The default implementations in this trait can be used in the common case when `CC[A]` is the
|same as `C`.
|EvidenceIterableFactoryDefaults scala.collection
|> Base trait for companion objects of unconstrained collection types that may require
|multiple traversals of a source collection to build a target collection `CC`.
|
|
|**Type Parameters**
|- `CC`: Collection type constructor (e.g. `List`)
|IterableFactory scala.collection
|> This trait provides default implementations for the factory methods `fromSpecific` and
|`newSpecificBuilder` that need to be refined when implementing a collection type that refines
|the `CC` and `C` type parameters.
|
|The default implementations in this trait can be used in the common case when `CC[A]` is the
|same as `C`.
|IterableFactoryDefaults scala.collection
|> Base trait for companion objects of collections that require an implicit `Ordering`.
|
|**Type Parameters**
|- `CC`: Collection type constructor (e.g. `SortedSet`)
|SortedIterableFactory scala.collection
|> **Type Parameters**
|- `A`: Type of elements (e.g. `Int`, `Boolean`, etc.)
|- `C`: Type of collection (e.g. `List[Int]`, `TreeMap[Int, String]`, etc.)
|SpecificIterableFactory scala.collection
|""".stripMargin
"2.13.1" -> iteratorDocs213,
"2.13.2" -> iteratorDocs213,
"2.13.3" -> iteratorDocs213.replace("it.next ", "it.next()")
)
)

Expand Down Expand Up @@ -461,6 +466,35 @@ class CompletionDocSuite extends BaseCompletionSuite {
|""".stripMargin
)
)

val vectorDocs213: String =
"""|> ### class Vector
|Vector is a general-purpose, immutable data structure. It provides random access and updates
|in O(log n) time, as well as very fast append/prepend/tail/init (amortized O(1), worst case O(log n)).
|Because vectors strike a good balance between fast random selections and fast random functional updates,
|they are currently the default implementation of immutable indexed sequences.
|
|Vectors are implemented by radix-balanced finger trees of width 32. There is a separate subclass
|for each level (0 to 6, with 0 being the empty vector and 6 a tree with a maximum width of 64 at the
|top level).
|
|Tree balancing:
|- Only the first dimension of an array may have a size < WIDTH
|- In a `data` (central) array the first dimension may be up to WIDTH-2 long, in `prefix1` and `suffix1` up
| to WIDTH, and in other `prefix` and `suffix` arrays up to WIDTH-1
|- `prefix1` and `suffix1` are never empty
|- Balancing does not cross the main data array (i.e. prepending never touches the suffix and appending never touches
| the prefix). The level is increased/decreased when the affected side plus main data is already full/empty
|- All arrays are left-aligned and truncated
|
|In addition to the data slices (`prefix1`, `prefix2`, ..., `dataN`, ..., `suffix2`, `suffix1`) we store a running
|count of elements after each prefix for more efficient indexing without having to dereference all prefix arrays.
|
|### object Vector
|$factoryInfo
|Vector scala.collection.immutable
|""".stripMargin

check(
"scala8",
"""
Expand Down Expand Up @@ -513,33 +547,8 @@ class CompletionDocSuite extends BaseCompletionSuite {
|$factoryInfo
|Vector scala.collection.immutable
|""".stripMargin,
"2.13.2" ->
"""|> ### class Vector
|Vector is a general-purpose, immutable data structure. It provides random access and updates
|in O(log n) time, as well as very fast append/prepend/tail/init (amortized O(1), worst case O(log n)).
|Because vectors strike a good balance between fast random selections and fast random functional updates,
|they are currently the default implementation of immutable indexed sequences.
|
|Vectors are implemented by radix-balanced finger trees of width 32. There is a separate subclass
|for each level (0 to 6, with 0 being the empty vector and 6 a tree with a maximum width of 64 at the
|top level).
|
|Tree balancing:
|- Only the first dimension of an array may have a size < WIDTH
|- In a `data` (central) array the first dimension may be up to WIDTH-2 long, in `prefix1` and `suffix1` up
| to WIDTH, and in other `prefix` and `suffix` arrays up to WIDTH-1
|- `prefix1` and `suffix1` are never empty
|- Balancing does not cross the main data array (i.e. prepending never touches the suffix and appending never touches
| the prefix). The level is increased/decreased when the affected side plus main data is already full/empty
|- All arrays are left-aligned and truncated
|
|In addition to the data slices (`prefix1`, `prefix2`, ..., `dataN`, ..., `suffix2`, `suffix1`) we store a running
|count of elements after each prefix for more efficient indexing without having to dereference all prefix arrays.
|
|### object Vector
|$factoryInfo
|Vector scala.collection.immutable
|""".stripMargin
"2.13.2" -> vectorDocs213,
"2.13.3" -> vectorDocs213
)
)
check(
Expand Down
6 changes: 3 additions & 3 deletions tests/slow/src/test/scala/tests/feature/AmmoniteSuite.scala
@@ -1,5 +1,5 @@
package tests.feature

import scala.meta.internal.metals.{BuildInfo => V}

class Ammonite213Suite extends tests.BaseAmmoniteSuite(V.scala213)
// import scala.meta.internal.metals.{BuildInfo => V}
// Ammonite repl is not yet release for 2.13.3
class Ammonite213Suite extends tests.BaseAmmoniteSuite("2.13.2")

0 comments on commit 217faef

Please sign in to comment.