diff --git a/modules/core/shared/src/main/scala/eu/timepit/refined/auto.scala b/modules/core/shared/src/main/scala/eu/timepit/refined/auto.scala index c4a326071..d1f8a2365 100644 --- a/modules/core/shared/src/main/scala/eu/timepit/refined/auto.scala +++ b/modules/core/shared/src/main/scala/eu/timepit/refined/auto.scala @@ -53,7 +53,7 @@ object auto { * Note: This conversion is not needed if `F[T, _] <: T` holds (which * is the case for `shapeless.tag.@@`, for example). */ - implicit def autoUnwrap[F[_, _], T](tp: F[T, _])(implicit rt: RefType[F]): T = + implicit def autoUnwrap[F[_, _], T, P](tp: F[T, P])(implicit rt: RefType[F]): T = rt.unwrap(tp) /** diff --git a/modules/core/shared/src/test/scala/eu/timepit/refined/AutoSpec.scala b/modules/core/shared/src/test/scala/eu/timepit/refined/AutoSpec.scala index e7f2a89df..5fec037ad 100644 --- a/modules/core/shared/src/test/scala/eu/timepit/refined/AutoSpec.scala +++ b/modules/core/shared/src/test/scala/eu/timepit/refined/AutoSpec.scala @@ -22,12 +22,18 @@ class AutoSpec extends Properties("auto") { a == b } - property("autoUnwrap") = secure { - val a: Char Refined Letter = 'A' - val b: Char = a + property("autoUnwrap: PosInt: Int") = secure { + val a: PosInt = PosInt.unsafeFrom(1) + val b: Int = a a.value == b } + property("autoUnwrap: PosInt + PosInt") = secure { + val a = PosInt.unsafeFrom(1) + val b = PosInt.unsafeFrom(2) + (a + b) == 3 + } + property("autoRefineV") = secure { val a: Char Refined Equal[W.`'0'`.T] = '0' illTyped("val b: Char Refined Equal[W.`'0'`.T] = '1'", """Predicate failed: \(1 == 0\).""") diff --git a/notes/0.9.5.markdown b/notes/0.9.5.markdown new file mode 100644 index 000000000..c78afedde --- /dev/null +++ b/notes/0.9.5.markdown @@ -0,0 +1,18 @@ +### Bug fixes + +* Add type parameter for the predicate type to `auto.autoUnwrap` in + order to improve type inference. + ([#608][#608], [#612][#612] by [@fthomas][@fthomas]) + +### Updates + +* Update Cats to 1.6.0. ([#609][#609] by [@scala-steward][@scala-steward]) +* Update scodec to 1.11.2. ([#611][#611] by [@scala-steward][@scala-steward]) + +[#608]: https://github.com/fthomas/refined/issues/608 +[#609]: https://github.com/fthomas/refined/pull/609 +[#611]: https://github.com/fthomas/refined/pull/611 +[#612]: https://github.com/fthomas/refined/pull/612 + +[@fthomas]: https://github.com/fthomas +[@scala-steward]: https://github.com/scala-steward