Skip to content

Commit e54a777

Browse files
committed
bail on RefinedLT and equalValidateInference
1 parent 74c2636 commit e54a777

File tree

6 files changed

+7
-102
lines changed

6 files changed

+7
-102
lines changed

modules/core/shared/src/main/scala/eu/timepit/refined/api/RefinedLT.scala

Lines changed: 0 additions & 36 deletions
This file was deleted.

modules/core/shared/src/main/scala/eu/timepit/refined/generic.scala

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
package eu.timepit.refined
22

3-
import eu.timepit.refined.api.{Inference, RefinedLT, Validate}
4-
import eu.timepit.refined.api.Inference.==>
5-
import eu.timepit.refined.generic._
3+
import eu.timepit.refined.api.Validate
64
import eu.timepit.refined.internal.WitnessAs
75
import shapeless._
86
import shapeless.ops.coproduct.ToHList
97
import shapeless.ops.hlist.ToList
108
import shapeless.ops.record.Keys
119

1210
/** Module for generic predicates. */
13-
object generic extends GenericInference {
11+
object generic {
1412

1513
/** Predicate that checks if a value is equal to `U`. */
1614
final case class Equal[U](u: U)
@@ -101,11 +99,3 @@ object generic extends GenericInference {
10199
Validate.alwaysPassed(Supertype())
102100
}
103101
}
104-
105-
private[refined] trait GenericInference {
106-
implicit def equalValidateInference[U, P](
107-
implicit
108-
tvp: RefinedLT[U, P]
109-
): Equal[U] ==> P =
110-
Inference(s"equalValidateInference(${tvp.expr})")
111-
}

modules/core/shared/src/main/scala/eu/timepit/refined/macros/RefineMacro.scala

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package eu.timepit.refined.macros
22

3-
import eu.timepit.refined.api.{RefinedLT, RefType, Validate}
3+
import eu.timepit.refined.api.{RefType, Validate}
44
import eu.timepit.refined.char.{Digit, Letter, LowerCase, UpperCase, Whitespace}
55
import eu.timepit.refined.collection.NonEmpty
6-
import eu.timepit.refined.internal.{Resources, WitnessAs}
6+
import eu.timepit.refined.internal.Resources
77
import eu.timepit.refined.numeric.{Negative, NonNegative, NonPositive, Positive}
88
import scala.reflect.macros.blackbox
99

@@ -38,27 +38,6 @@ class RefineMacro(val c: blackbox.Context) extends MacroUtils with LiteralMatche
3838
): c.Expr[FTP] =
3939
c.Expr[FTP](impl(t)(rt, v).tree)
4040

41-
def implRefLT[L: c.WeakTypeTag, T: c.WeakTypeTag, P: c.WeakTypeTag](
42-
w: c.Expr[WitnessAs[L, T]],
43-
v: c.Expr[Validate[T, P]]
44-
): c.Expr[RefinedLT[L, P]] = {
45-
// doing eval(v) before eval(w) is important for... reasons.
46-
val validate = eval(v)
47-
val litval = w.tree match {
48-
case q"$_.WitnessAs.natWitnessAs[..$_]($_, new $_.Inst[..$_]($lv).asInstanceOf[..$_], $_)" => {
49-
// trying to eval the Nat witness directly confuses the typer, it is
50-
// tripping on some type recursion involving _5 and Succ[_4] in same expression
51-
eval(c.Expr[T](lv))
52-
}
53-
case _ => eval(w).snd
54-
}
55-
val res = validate.validate(litval)
56-
if (res.isFailed) {
57-
abort(validate.showResult(litval, res))
58-
}
59-
RefinedLT.manifest[L, T, P](c)(w, v)
60-
}
61-
6241
private def validateInstance[T, P](v: c.Expr[Validate[T, P]])(
6342
implicit
6443
T: c.WeakTypeTag[T],

modules/core/shared/src/test/scala/eu/timepit/refined/AutoSpec.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import shapeless.test.illTyped
1313
class AutoSpec extends Properties("auto") {
1414
property("autoInfer") = secure {
1515
val a: Char Refined Equal[W.`'0'`.T] = '0'
16-
val b: Char Refined Digit = a
16+
val b: Char Refined Digit = '0'
1717
illTyped(
1818
"val c: Char Refined Letter = a",
1919
"""type mismatch.*"""

modules/core/shared/src/test/scala/eu/timepit/refined/CollectionInferenceSpec.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ import shapeless.test.illTyped
1313
class CollectionInferenceSpec extends Properties("CollectionInference") {
1414
import shim.Inference
1515

16+
/*
1617
property("Exists[A] ==> Exists[B]") = secure {
1718
Inference[Contains[W.`'5'`.T], Exists[Digit]].isValid
1819
}
19-
20+
*/
2021
property("Exists ==> NonEmpty") = secure {
2122
Inference[Exists[Digit], NonEmpty].isValid
2223
}

modules/core/shared/src/test/scala/eu/timepit/refined/GenericInferenceSpec.scala

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)