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
1
vote
0 answers

Why am I not being warned about a non-exhaustive match?

Compiling this code does not result in any warnings about exhaustive pattern matches. package example object Hello extends App { class Problem extends Exception { override def getCause() : Throwable = new NotImplementedError("I'm not done") …
Tim Stewart
  • 5,350
  • 2
  • 30
  • 45
1
vote
0 answers

Why a Scala 2.13 app is trying to use `JavaClassValue` on Android if it is not available, then triggering `java.lang.NoClassDefFoundError`?

I'm running a Scala app on Android using https://github.com/dsvdsv/scala-android-plugin and Scala 2.13.8 and I get these weird stack traces on the logs: 07-19 11:46:26.057 3647 3647 I zygote64: Rejecting re-init on previously-failed class…
fiatjaf
  • 11,479
  • 5
  • 56
  • 72
1
vote
0 answers

AKKA HTTP(scala) cannot handle Json Array after I upgrade from scala 2.12 to 2.13.8

I've been researching for days about this problem. I was upgrading scala version of my project from 2.12.15 to 2.13.8, in the meantime I upgraded spray-json from 1.3.4 to 1.3.6. akka-http-spray-json is still 10.2.7. Within building there are…
Hustwhw
  • 196
  • 1
  • 6
1
vote
1 answer

How to fix the problem "Fatal error: java.lang.Object is missing called from core module analyzer" in ScalaJS Linking

I'm trying to defer ScalaJS Linking to runtime, which allows multi-stage compilation to be more flexible and less dependent on sbt. The setup looks like this: Instead of using scalajs-sbt plugin, I chose to invoke scalajs-compiler directly as a…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
1
vote
1 answer

Is it possible to write a "zipAll" function for scala inductive list (shapeless.HList in scala 2 or Tuple in scala 3)?

To this date, the "zip" function in HList works like zip function or untyped List in scala. It will discard elements from the longer operand to be conformant to the shorter element: val a = 1 :: 2 :: 3 :: HNil val b = 4 :: 5 ::…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
1
vote
1 answer

Scala runtime compilation: how to get line number of the error message?

I have found that scala compiler report compile error differently depends on whether it is used in compile-time or run-time. E.g. for a simple implicit not found case, in compile time the report is: newSource1.scala:6: error: type mismatch; L|R …
tribbloid
  • 4,026
  • 14
  • 64
  • 103
1
vote
1 answer

In scala 2.13.6+ library, what are the purposes of automatically generated functions with `$extension` suffix?

When I read the decompiled bytecode of scala, I found a lot of functions under the class scala.StringOps: @scala.inline final def view$extension($this : scala.collection.StringOps) : scala.collection.StringView = { /* compiled code */ } …
tribbloid
  • 4,026
  • 14
  • 64
  • 103
1
vote
2 answers

What is the best way to return a view to an ArraySeq?

Ideally when working from an IndexedSeqView over an ArraySeq, there should be only one array copy (or at least only one new array allocated) when converting the view back to an ArraySeq after some manipulation. What is the most performant way to get…
kag0
  • 5,624
  • 7
  • 34
  • 67
1
vote
1 answer

How to make a function working with different collection type in Scala 2.13?

Following function accepted more or less any collection and returned it filtered: def filterEven[Repr](o: collection.IterableLike[Int, Repr]): Repr = { o.filter { o => (o % 2) == 0 } } filterEven(List(1, 2, 3)) filterEven(Set(1, 2,…
Suma
  • 33,181
  • 16
  • 123
  • 191
1
vote
1 answer

Conversion of breakOut - use iterator or view?

Scala 2.13 migration guide contains a note regarding how to port collection.breakOut: collection.breakOut no longer exists, use .view and .to(Collection) instead. and few paragraphs below in a overview table there is: Description Old Code New…
Suma
  • 33,181
  • 16
  • 123
  • 191
1
vote
1 answer

In scala, can a function be defined to have pass-by-AST parameter, such that the input AST of a function can be passed to a macro as-is?

I'll use the shapeless library as an example: import shapeless.test.illTyped assuming that I want to wrap the illType function in another function, I've tried 2 different ways to do this: (by value) def shouldTypeError(v: String) = illTyped(v,…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
1
vote
2 answers

In scala, How to call generalised copy function of a case class if it is declared in a family outer type? - Part 2

This is a follow up question of Part1: In scala, How to call generalised copy function of a case class if it is declared in a family outer type? In Part 2, the definition of the family class become slightly more complex: trait OuterSpike { class…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
1
vote
1 answer

In scala, How to call generalised copy function of a case class if it is declared in a family outer type?

This is a scala problem caused by path-dependent type: Considering that I have a family type: trait Outer { case class Inner(v: Int) { val outer = Outer.this } } If I want to call Outer#Inner.copy() when the instance of Outer is…
tribbloid
  • 4,026
  • 14
  • 64
  • 103
1
vote
0 answers

In scala 2.13. What's the cause of the problem "java.lang.IndexOutOfBoundsException: 0" in macro expansion?

I'm experimenting the macro in this answer: How to get the name of a class as a string literal at compile time using shapeless? The following macro is used to extract type description from a type parameter: object typeablePoly extends Poly1 { …
tribbloid
  • 4,026
  • 14
  • 64
  • 103
1
vote
1 answer

NullPointerException on XML.loadFile()

I am trying to load an xml file using scala-xml_2.12-1.0.6.jar but it gives me NullPointerEexception while loading Following is my line of code to load xml import scala.xml.XML val xml = XML.loadFile("sample.xml") I have decompiled this jar and is…
M.Ahsen Taqi
  • 965
  • 11
  • 35