TypeTag in Scala 1.13.1

Was there a change to how to work with TypeTag in Scala 2.13.x?

I cannot import anything from scala.reflect.api.

UPDATE: I now added libraryDependencies += "org.scala-lang" % "scala-reflect" % "2.13.1" but still cannot use TypeTag. Apprently it is a trait within scala.reflect.api.TypeTags.

What am I doing wrong?

I don’t think you mean Scala 1.13.1. (Scala 1 was many, many years ago, and I don’t think there ever was a 1.13.)

Assuming you mean 2.13.1, it’s still there, but it’s in the Reflection Library (not the base standard library) – documentation here.

1 Like

Yes, of course, I mean 2.13.1 :slight_smile:

Do I have to add this library to my build.sbt?

I believe the correct import is scala.reflect.runtime.universe._

Thank you, I will try that.

But I just realized that - once again - I mixed up ClassTag and TypeTag - and I need a ClassTag which works just fine :slight_smile:

2 Likes

Okay, cool. Yeah, TypeTag is crazy-powerful, but not often needed. ClassTag is more generally useful. (And will be in Scala 3, which TypeTag will probably not.)

1 Like