Scala 2.11.5 compiler crash with type aliases and manifests

前端 未结 1 1544

It appears that passing an alias to a wild-carded parameterized type to a function that tries to get an implicit Manifest for the type will crash the Scala 2.11.5 c

相关标签:
1条回答
  • 2021-01-21 13:53

    Use scala.reflect.runtime.universe.TypeTag (or scala.reflect.ClassTag if it's sufficient; since you mention taking Class as an option, it may be) instead of Manifest. They are inserted as implicit arguments by the compiler in the same way as Manifests are. See http://docs.scala-lang.org/overviews/reflection/typetags-manifests.html for more. In particular, note

    In Scala 2.10, scala.reflect.ClassManifests are deprecated, and it is planned to deprecate scala.reflect.Manifest in favor of TypeTags and ClassTags in an upcoming point release.

    You probably should still report the bug; even if it's marked as wont-fix, it'll help people who stumble over this in the future.

    0 讨论(0)
提交回复
热议问题