Questions tagged [scala-2.13]

Version 2.13 of the Scala programming language. Use for questions particularly addressing features of this version of Scala.

Scala 2.13 brings improvements in

  • compiler performance
  • simplifying the collections
  • modularizing the standard library
  • user-friendliness
100 questions
22
votes
1 answer

Missing import scala.collection.parallel in Scala 2.13

Parallel collections in Scala 2.12 were importable out-of-the-box like so import scala.collection.parallel.immutable.ParVector val pv = new ParVector[Int] however why in Scala 2.13 package scala.collection.parallel seems to be missing?
Mario Galic
  • 47,285
  • 6
  • 56
  • 98
18
votes
1 answer

Why am I getting this error when running Scala 2.13 tests in IntelliJ, but not with Scala 2.12?

I am getting the following error when I try to run tests in IntelliJ (2019.1), Scala IntelliJ plugin v2019.1.8, with Scala 2.13: Exception in thread "ScalaTest-dispatcher" java.lang.NoSuchMethodError:…
GreenSaguaro
  • 2,968
  • 2
  • 22
  • 41
11
votes
1 answer

Scala 2.13 what to use instead of MutableList?

I'm upgrading a software from Scala 2.12.8 to Scala 2.13, and figure out that the collection MutableList (scala.collection.mutable.MutableList) was removed according to many guides (like this one). This guide, for example, say that this was a…
Fernando Rezk
  • 314
  • 1
  • 18
8
votes
1 answer

Why can I use `to` in the first argument of Future.traverse, but not `until`?

Why can I use to to construct a Range for the first argument of Future.traverse, but not until? See the following example Scala console interaction. scala> Future.traverse(1 to 5)(Future.successful) val res5: scala.concurrent.Future[IndexedSeq[Int]]…
Tom Wang
  • 877
  • 1
  • 9
  • 15
7
votes
2 answers

Missing par method from Scala collections

I tried to convert a sequential list to a parallel one in Intellij, but I get the error Cannot resolve symbol par on the .par method call: import scala.collection.parallel.immutable._ ... val parList = List(1,2,3).par According to…
7
votes
1 answer

Migrating a generic append function to Scala 2.13 collections

I have the following extension class that adds a myAppend method to anything SeqLike. implicit class WithAppend[A, R](s: SeqLike[A, R]) extends AnyVal { def myAppend(i: A)(implicit cbf: CanBuildFrom[R, A, R]): R = s :+ i } How can I port this…
thesamet
  • 6,382
  • 2
  • 31
  • 42
6
votes
1 answer

In scala macro, how to retrieve full type information from a WeakTypeTag?

I'm writing macro to convert a type description into a singleton type: object Type2String { def apply[I]: Witness.Lt[String] = macro Macros.apply[I] final class Macros(val c: whitebox.Context) extends MWithReflection { import…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
5
votes
1 answer

When using scala path dependent type as function codomain, why is it impossible to add alias for that function?

Here is a simple example: trait Proposition[T] { type Repr = T } trait Scope { type OUT type Consequent = Proposition[_ <: OUT] abstract class Proof[-I, +P <: Consequent] { final def instanceFor(v: I): P#Repr = ??? final def…
5
votes
1 answer

Getting MatchError when using a placeholder for an unused variable

With Scala 2.13.x, I am getting scala.MatchError: null when I use a placeholder for an unused variable: scala> object Test { | val _: Any = null | } object Test scala> Test scala.MatchError: null ... 41 elided But with Scala 2.12.x,…
himanshuIIITian
  • 5,985
  • 6
  • 50
  • 70
5
votes
1 answer

How to pattern match in scala 2.13?

I have the following regex, that I would like to pattern match in Scala 2.13. The regex: \/brokers\/ids\/\d{1,}$ The following string, that is going to be validate: scala> ("echo dump" #| "nc localhost 32773" #| "grep brokers").!! res2: String…
softshipper
  • 32,463
  • 51
  • 192
  • 400
5
votes
1 answer

Difference between size and sizeIs

What is the semantic difference between size and sizeIs? For example, List(1,2,3).sizeIs > 1 // true List(1,2,3).size > 1 // true Luis mentions in a comment that ...on 2.13+ one can use sizeIs > 1 which will be more efficient than size > 1 as…
Mario Galic
  • 47,285
  • 6
  • 56
  • 98
4
votes
1 answer

Method type confused when using self type

Following code does not compile with Scala 2 (tested 2.13.7 and Scala 2.12.15): trait AttributeBase trait Attribute extends AttributeBase { def name: String } trait Base { def attribute: AttributeBase } trait Derived { self: Base => def…
Suma
  • 33,181
  • 16
  • 123
  • 191
4
votes
0 answers

How can I tell scalac to suppress warnings is macro-generated code?

I'm currently using a macro (ZIO's @mockable) whose generated code is causing a compilation error that is causing my build to fail: [error] /home/me/xxx/backend/:5:204: parameter value rts in anonymous function is never used [error] val…
tjarvstrand
  • 836
  • 9
  • 20
4
votes
1 answer

Scala: Alternative for deprecated set difference

I need to remove some sets from a master set. The following code shows the concept I intend to work but it is generating warnings for deprecation. The suggestion given by Scala is not useful as I want to repeatedly update master set. Could anyone…
xinit
  • 147
  • 9
4
votes
0 answers

How to find the minimum of a Seq in scala 2.13+

In earlier versions of Scala, I used to be able to do something like this to get the minimum value: val minValue = Seq[Float](0.3f, 0.5f, 0.1f, 0.8f).min That seemed simple and easy to understand. In Scala 2.13.1, I get this error: object…
user1933178
  • 340
  • 3
  • 12
1
2 3 4 5 6 7