Skip to content

NoSuchElementException thrown in REPL when using a type alias to refer to a shapeless coproduct #198

@mpilquist

Description

@mpilquist
› ./amm
Loading...
Welcome to the Ammonite Repl 0.4.5
(Scala version 2.11.7 Java 1.8.0_25)
@ load.ivy("com.chuusai" %% "shapeless" % "2.2.5")

@ import shapeless._
import shapeless._
@ Coproduct[Int :+: String :+: CNil](1)
res2: Int :+: String :+: CNil = Inl(1)
@ type X = Int :+: String :+: CNil
defined type X
@ Coproduct[X](1)
Compilation Failed
Main.scala:289: exception during macro expansion:
java.util.NoSuchElementException: head of empty list
        at scala.collection.immutable.Nil$.head(List.scala:420)
        at scala.collection.immutable.Nil$.head(List.scala:417)
        at scala.reflect.internal.tpe.TypeMaps$SubstMap.subst(TypeMaps.scala:709)
        at scala.reflect.internal.tpe.TypeMaps$SubstMap.substFor$1(TypeMaps.scala:717)
        at scala.reflect.internal.tpe.TypeMaps$SubstMap.apply(TypeMaps.scala:732)
        at scala.reflect.internal.tpe.TypeMaps$SubstMap.apply(TypeMaps.scala:685)
        at scala.collection.immutable.List.loop$1(List.scala:173)
        at scala.collection.immutable.List.mapConserve(List.scala:189)
        at scala.reflect.internal.tpe.TypeMaps$TypeMap.mapOver(TypeMaps.scala:115)
        at scala.reflect.internal.tpe.TypeMaps$SubstMap.apply(TypeMaps.scala:716)
        at scala.reflect.internal.Types$Type.subst(Types.scala:705)
        at scala.reflect.internal.Types$TypeApiImpl.substituteTypes(Types.scala:240)
        at scala.reflect.internal.Types$TypeApiImpl.substituteTypes(Types.scala:218)
        at derive.Derive$$anonfun$impl$1$2.apply(Derive.scala:77)
        at derive.Derive$$anonfun$impl$1$2.apply(Derive.scala:74)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:245)
        at scala.collection.immutable.Set$Set2.foreach(Set.scala:111)
        at scala.collection.TraversableLike$class.map(TraversableLike.scala:245)
        at scala.collection.AbstractSet.scala$collection$SetLike$$super$map(Set.scala:47)
        at scala.collection.SetLike$class.map(SetLike.scala:92)
        at scala.collection.AbstractSet.map(Set.scala:47)
        at derive.Derive.impl$1(Derive.scala:74)
        at derive.Derive.fleshedOutSubtypes(Derive.scala:81)
        at derive.Derive.derive$Derive$$onFail$1(Derive.scala:136)
        at derive.Derive$$anonfun$derive$Derive$$rec$1$1.apply(Derive.scala:204)
        at derive.Derive$$anonfun$derive$Derive$$rec$1$1.apply(Derive.scala:178)
        at scala.collection.mutable.MapLike$class.getOrElseUpdate(MapLike.scala:194)
        at scala.collection.mutable.AbstractMap.getOrElseUpdate(Map.scala:80)
        at derive.Derive.derive$Derive$$rec$1(Derive.scala:178)
        at derive.Derive.deriveType(Derive.scala:217)
        at derive.Derive.derive(Derive.scala:58)
        at pprint.Internals$LowerPriPPrint$.liftedTree1$1(PPrint.scala:398)
        at pprint.Internals$LowerPriPPrint$.FinalRepr(PPrint.scala:398)

        def $main() = { ammonite.repl.frontend.ReplBridge.repl.Internal.combinePrints(ammonite.repl.frontend.ReplBridge.repl.Internal.print(res4, res4, "res4", None)) }
                                                                                                                                           ^
@

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions