diff --git a/core/src/main/scala/shapeless/labelled.scala b/core/src/main/scala/shapeless/labelled.scala index 8909918ee..d5d84dbaf 100644 --- a/core/src/main/scala/shapeless/labelled.scala +++ b/core/src/main/scala/shapeless/labelled.scala @@ -23,7 +23,7 @@ object labelled { /** The type of fields with keys of singleton type `K` and value type `V`. */ type FieldType[K, +V] = V with KeyTag[K, V] - trait KeyTag[K, +V] + trait KeyTag[K, +V] extends Any /** Yields a result encoding the supplied value with the singleton type `K` of its key. */ def field[K]: FieldBuilder[K] = new FieldBuilder(true) diff --git a/core/src/test/scala/shapeless/records.scala b/core/src/test/scala/shapeless/records.scala index c68371c2d..09ca02631 100644 --- a/core/src/test/scala/shapeless/records.scala +++ b/core/src/test/scala/shapeless/records.scala @@ -1167,4 +1167,16 @@ class RecordTests { assertTypedEquals[Witness.`"a"`.T](swapped.head, select(swapped)) } + + @Test + def testFieldTypeOfValueClass: Unit = { + import RecordTests._ + val x = aValueClassField ->> AValueClass(1L) + assertEquals(x.l, Array(x).apply(0)) + } +} + +object RecordTests { + case class AValueClass(l: Long) extends AnyVal + object aValueClassField extends FieldOf[AValueClass] }