Skip to content

java.lang.ClassCastException while running inlining (while deriving sealed trait with abstract subclass) #465

@MartinHH

Description

@MartinHH

Scala 3.2.2, upickle 3.0.0, sbt 1.8.2

import upickle.default._

sealed trait ShirtSize derives ReadWriter

case object UnknownShirtSize extends ShirtSize

sealed abstract class KnownShirtSize(val width: Int) extends ShirtSize

case object XL extends KnownShirtSize(50)

Gives me (when compiling):

[info] compiling 1 Scala source to /path/of/myproject/target/scala-3.2.2/classes ...
java.lang.ClassCastException while running inlining on /path/of/myproject/src/main/scala/ShirtSize.scala
[info] exception occurred while compiling /path/of/myproject/src/main/scala/ShirtSize.scala
java.lang.ClassCastException while compiling /path/of/myproject/src/main/scala/ShirtSize.scala
[error] ## Exception when compiling 1 sources to /path/of/myproject/target/scala-3.2.2/classes
[error] java.lang.ClassCastException
[error] 
[error]            
[error] stack trace is suppressed; run last myproject / Compile / compileIncremental for the full output
[error] (myproject / Compile / compileIncremental) java.lang.ClassCastException
[error] Total time: 0 s, completed 12.03.2023, 15:45:44

Also reproduceable via scastie: https://scastie.scala-lang.org/l74VUdqsRzODJlkhMqQmNA - there it says:
java.lang.ClassCastException: class dotty.tools.dotc.core.Symbols$NoSymbol$ cannot be cast to class dotty.tools.dotc.core.Symbols$ClassSymbol

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions