diff --git a/scio-core/src/main/scala/com/spotify/scio/coders/LowPriorityCoderDerivation.scala b/scio-core/src/main/scala/com/spotify/scio/coders/LowPriorityCoderDerivation.scala index aa2c782633..123e915e78 100644 --- a/scio-core/src/main/scala/com/spotify/scio/coders/LowPriorityCoderDerivation.scala +++ b/scio-core/src/main/scala/com/spotify/scio/coders/LowPriorityCoderDerivation.scala @@ -95,9 +95,9 @@ object LowPriorityCoderDerivation { def id(v: T): Int = subTypes.collectFirst { case (isType, index) if isType(v) => index }.get } - def colsureFunction[E, D, R](enclosed: E)(gen: E => D => R): D => R = gen(enclosed) + def closureFunction[E, D, R](enclosed: E)(gen: E => D => R): D => R = gen(enclosed) - def colsureSupplier[E, R](enclosed: E)(gen: E => R): () => R = () => gen(enclosed) + def closureSupplier[E, R](enclosed: E)(gen: E => R): () => R = () => gen(enclosed) } @@ -114,11 +114,11 @@ trait LowPriorityCoderDerivation { if (ctx.isValueClass) { val p = ctx.parameters.head Coder.xmap(p.typeclass.asInstanceOf[Coder[Any]])( - colsureFunction(constructor)(c => v => c.rawConstruct(Seq(v))), + closureFunction(constructor)(c => v => c.rawConstruct(Seq(v))), p.dereference ) } else if (ctx.isObject) { - Coder.singleton(typeName, colsureSupplier(constructor)(_.rawConstruct(Seq.empty))) + Coder.singleton(typeName, closureSupplier(constructor)(_.rawConstruct(Seq.empty))) } else { Coder.ref(typeName) { val cs = Array.ofDim[(String, Coder[Any])](ctx.parameters.length) @@ -128,7 +128,7 @@ trait LowPriorityCoderDerivation { } Coder.record[T](typeName, cs)( - colsureFunction(constructor)(_.rawConstruct), + closureFunction(constructor)(_.rawConstruct), v => ProductIndexedSeqLike(v.asInstanceOf[Product]) ) } @@ -145,10 +145,10 @@ trait LowPriorityCoderDerivation { val booleanId: Int => Boolean = _ != 0 val cs = coders.map { case (key, v) => (booleanId(key), v) } Coder.disjunction[T, Boolean](typeName, cs)( - colsureFunction(identifier)(_.id).andThen(booleanId) + closureFunction(identifier)(_.id).andThen(booleanId) ) } else { - Coder.disjunction[T, Int](typeName, coders)(colsureFunction(identifier)(_.id)) + Coder.disjunction[T, Int](typeName, coders)(closureFunction(identifier)(_.id)) } }