milessabin / shapeless

Generic programming for Scala

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strange behavior when using -release 8 scalac option

Jasper-M opened this issue · comments

scalaVersion := "2.13.8"

libraryDependencies += "com.chuusai" %% "shapeless" % "2.3.8"

scalacOptions ++= List("-release", "8")
Welcome to Scala 2.13.8 (OpenJDK 64-Bit Server VM, Java 11.0.14).
Type in expressions for evaluation. Or try :help.

scala> shapeless.LabelledGeneric[java.time.Instant]
val res0: shapeless.LabelledGeneric[java.time.Instant]{type Repr = shapeless.HNil} = shapeless.LabelledGeneric$$anon$2@6f3ac7af

Shapeless seems to treat java.time.Instant as a nullary case class now.
The culprit is probably the compiler, but filing it here too since shapeless and downstream libraries are affected.

Compiler ticket and likely cause of this issue: scala/bug#12565

My theory is that the fake constructor causes shapeless to think that Instant is "case class like".

wow 😮

Since the bug was confirmed in Scala and already has PR I think we can close it here