Closed
Description
Compiler version
3.5.0-RC1
Minimized code
//> using options -source:3.5-migration
final class StrictEqual[V]
final class Less[V]
type LessEqual[V] = Less[V] | StrictEqual[V]
object TapirCodecIron:
trait ValidatorForPredicate[Value, Predicate]
trait PrimitiveValidatorForPredicate[Value, Predicate]
extends ValidatorForPredicate[Value, Predicate]
given validatorForLessEqual[N: Numeric, NM <: N](using
ValueOf[NM]
): PrimitiveValidatorForPredicate[N, LessEqual[NM]] = ???
given validatorForDescribedOr[N, P](using
IsDescription[P]
): ValidatorForPredicate[N, P] = ???
trait IsDescription[A]
object IsDescription:
given derived[A]: IsDescription[A] = ???
@main def Test = {
import TapirCodecIron.{*, given}
type IntConstraint = LessEqual[3]
summon[ValidatorForPredicate[Int, IntConstraint]]
}
Output
[error] ./tapir.repro.scala:24:52
[error] Ambiguous given instances: both given instance validatorForDescribedOr in object TapirCodecIron and given instance validatorForLessEqual in object TapirCodecIron match type TapirCodecIron.ValidatorForPredicate[Int, IntConstraint] of parameter x of method summon in object Predef
[error] summon[ValidatorForPredicate[Int, IntConstraint]]
[error] ^
Error compiling project (Scala 3.5.0-RC1, JVM (17))
Expectation
Should yield warning as it does under -source:3.5
Compiling project (Scala 3.5.0-RC1, JVM (17))
[warn] ./tapir.repro.scala:24:52
[warn] Given search preference for TapirCodecIron.ValidatorForPredicate[Int, IntConstraint] between alternatives (TapirCodecIron.validatorForDescribedOr :
[warn] [N, P]
[warn] (using x$1: TapirCodecIron.IsDescription[P]):
[warn] TapirCodecIron.ValidatorForPredicate[N, P]
[warn] ) and (TapirCodecIron.validatorForLessEqual :
[warn] [N, NM <: N]
[warn] (implicit evidence$1: Numeric[N], x$1: ValueOf[NM]):
[warn] TapirCodecIron.PrimitiveValidatorForPredicate[N, LessEqual[NM]]
[warn] ) will change
[warn] Current choice : the second alternative
[warn] New choice from Scala 3.6: none - it's ambiguous
[warn] summon[ValidatorForPredicate[Int, IntConstraint]]
[warn] ^
Compiled project (Scala 3.5.0-RC1, JVM (17))