@quote: Looks a bit similar to TypeTag
izumi-reflect
is a fast, lightweight, portable and efficient alternative for TypeTag
from scala-reflect
.
izumi-reflect
is a lightweight model of Scala type system and provides a simulator of the important parts of the Scala typechecker.
izumi-reflect
compiles faster, runs a lot faster thanscala-reflect
and is fully immutable and thread-safe,izumi-reflect
supports Scala.js, Scala Native,izumi-reflect
is published for Scala 3, you may check port status here (#22),izumi-reflect
allows you to obtain tags for unapplied type constructors (F[_]
) and combine them at runtime.
izumi-reflect
has been created by Septimal Mind to power Izumi Project,
as a replacement for TypeTag
in reaction to a lack of confirmed information about the future of scala-reflect
/TypeTag
in Scala 3 (Motivation),
and donated to ZIO.
This repository contains an independent and more conservative copy of the code comparing to Izumi one.
izumi-reflect
model of the Scala type system is not 100% precise, but "good enough" for the vast majority of the usecases.
Known limitations are:
- Type boundaries support is very limited because of a problematic behavior of Scala 2.13 compiler,
- Recursive type bounds (F-bounded types) are not preserved and may produce false positives,
- Existential types written with
forSome
are not supported and may produce unexpected results, - Path-Dependent Types are based on variable names and may cause unexpected results with variables with different names but the same type or vice-versa (vs. Scala typechecker)
- At the moment Scala 3 port does not support Path-Dependent Types, and Structural Refinements. This will be fixed in future.
When working on the Scala 3 version of the codebase in Intellij, we recommend importing using BSP mode instead of sbt mode, see Dotty#Importing the Project Using BSP.
build.sbt
is generated by sbtgen. During development you may not want to mess with ScalaJS and ScalaNative, you may generate a pure-JVM Scala project:
./sbtgen.sc
Once you finished tinkering with the code you may want to generate full project and test it for all the platforms:
./sbtgen.sc --js --native
sbt +test
To develop using Scala 2 invoke sbtgen with scala version argument:
./sbtgen.sc 2 // 2.13.X
./sbtgen.sc 2.12 // 2.12.X