Skip to content

Commit

Permalink
Merge pull request #1401 from benoitlouy/fix-bijection
Browse files Browse the repository at this point in the history
fix infinite recursion when calling Bijection.identity
  • Loading branch information
daddykotex authored Feb 12, 2024
2 parents f3f28fc + 95e582c commit cbd5afd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/core/src/smithy4s/Bijection.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package smithy4s

import scala.Predef.{identity => identity0, _}

/**
* A bijection is an association of two opposite functions A => B and B => A.
*
Expand Down Expand Up @@ -47,7 +49,7 @@ trait Bijection[A, B] extends Function[A, B] { outer =>
}

object Bijection {
def identity[A]: Bijection[A, A] = apply(identity[A], identity[A])
def identity[A]: Bijection[A, A] = apply(identity0[A], identity0[A])

def apply[A, B](to: A => B, from: B => A): Bijection[A, B] =
new Impl[A, B](to, from)
Expand Down

0 comments on commit cbd5afd

Please sign in to comment.