From a9184f8f61a8dd6ad3f52009116fe3edb82f062f Mon Sep 17 00:00:00 2001 From: Michel Davit Date: Tue, 22 Aug 2023 15:56:55 +0200 Subject: [PATCH] Add back runtime check for scala 3 --- .../src/main/scala-3/magnolify/shared/EnumTypeDerivation.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shared/src/main/scala-3/magnolify/shared/EnumTypeDerivation.scala b/shared/src/main/scala-3/magnolify/shared/EnumTypeDerivation.scala index c2fa8072f..7386bc037 100644 --- a/shared/src/main/scala-3/magnolify/shared/EnumTypeDerivation.scala +++ b/shared/src/main/scala-3/magnolify/shared/EnumTypeDerivation.scala @@ -20,6 +20,9 @@ import magnolia1.{CaseClass, Derivation, SealedTrait} trait EnumTypeDerivation extends Derivation[EnumType]: def join[T](caseClass: CaseClass[EnumType, T]): EnumType[T] = + // fail at runtime since we can't prevent derivation + // see https://github.com/softwaremill/magnolia/issues/267 + require(caseClass.isObject, s"Cannot derive EnumType[T] for case class ${caseClass.typeInfo}") val n = caseClass.typeInfo.short val ns = caseClass.typeInfo.owner EnumType.create(