Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
Add isClass checking to avoid possible unexpected compilation error…
Browse files Browse the repository at this point in the history
…s on `asClass` calls
  • Loading branch information
plokhotnyuk committed May 22, 2018
1 parent 4bd9aec commit efe51b4
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ object Serializer {
}

def isSupportedValueClass(tpe: Type) =
tpe <:< typeOf[AnyVal] && tpe.typeSymbol.asClass.isDerivedValueClass && hasSingleArgPublicConstructor(tpe)
tpe <:< typeOf[AnyVal] && tpe.typeSymbol.isClass &&
tpe.typeSymbol.asClass.isDerivedValueClass && hasSingleArgPublicConstructor(tpe)

def resolveConcreteType(tpe: Type, mtpe: Type): Type = {
val tpeTypeParams =
Expand Down Expand Up @@ -355,7 +356,8 @@ object Serializer {
writer -> namedArgReader
}

if (!tpe.typeSymbol.asClass.isCaseClass) c.error(c.enclosingPosition, s"$tpe must be a case class.")
if (!(tpe.typeSymbol.isClass && tpe.typeSymbol.asClass.isCaseClass))
c.error(c.enclosingPosition, s"$tpe must be a case class.")

val annotations = tpe.members.collect {
case m: TermSymbol if {
Expand Down

0 comments on commit efe51b4

Please sign in to comment.