Skip to content

scalac GC error with LocalDateTime, Generic and Selector #819

@qwe2

Description

@qwe2

I have a strange error with Generic and Select on a case class containing LocalDateTime. I haven't been able to pinpoint the issue exactly, but having both in my case class causes very high compilation times in my project. Example code:

  case class WAT(
    ld: java.time.LocalDate,
    a: String,
    b: String,
    ldt: java.time.LocalDateTime
  )

  def x[H <: HList, T](
    implicit
    gen: Generic.Aux[WAT, H],
    at: Selector[H, LocalDateTime]
  ): Nothing = ???

x

This is the minimal failing example I could come up with. This causes scalac to go on for what seems to be forever (haven't finished in ~1 hour), with a lot of GC activity and 1GB of heap space. If I increase the number of fields it will eventually fail with the below error. If I remove a: String or b: String from the case class, the compilation still takes a bit longer than usual (ie, if I do Selector[H, String] the compilation time is noticeably quicker), but it still compiles. Is this an issue with shapeless or am I doing something else wrong that I don't quite see?

Error:scalac: Error: GC overhead limit exceeded
java.lang.OutOfMemoryError: GC overhead limit exceeded
	at scala.reflect.internal.Types$Type.scala$reflect$internal$Types$Type$$findMemberInternal$1(Types.scala:1019)
	at scala.reflect.internal.Types$Type.findMember(Types.scala:1021)
	at scala.reflect.internal.Types$Type.memberBasedOnName(Types.scala:636)
	at scala.reflect.internal.Types$Type.nonPrivateMember(Types.scala:612)
	at scala.reflect.internal.Types$class.rebind(Types.scala:3422)
	at scala.reflect.internal.Types$class.typeRef(Types.scala:3497)
	at scala.reflect.internal.SymbolTable.typeRef(SymbolTable.scala:16)
	at scala.reflect.internal.Symbols$TypeSymbol.newTypeRef(Symbols.scala:3081)
	at scala.reflect.internal.Symbols$TypeSymbol.typeConstructor(Symbols.scala:3103)
	at scala.reflect.internal.Symbols$TypeSymbol.tpeHK(Symbols.scala:3106)
	at scala.reflect.internal.Types$TypeVar$.createTypeVar(Types.scala:2833)
	at scala.reflect.internal.Types$TypeVar$.apply(Types.scala:2806)
	at scala.reflect.internal.Types$ExistentialType$$anonfun$23.apply(Types.scala:2701)
	at scala.reflect.internal.Types$ExistentialType$$anonfun$23.apply(Types.scala:2701)
	at scala.collection.immutable.List.map(List.scala:284)

Scala version: 2.11.11
Shapeless version: 2.3.2

Please note that these are the latest versions I'm able to use due to some restrictions on the project.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions