Skip to content

Commit 1f6e3a3

Browse files
authored
Merge pull request #623 from scala/backport-lts-3.3-24156
Backport "Fix "Regression in zio/zio-schema for typer/implicit resolution"" to 3.3 LTS
2 parents af99289 + ace7c9a commit 1f6e3a3

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6605,7 +6605,10 @@ object Types extends TypeUtils {
66056605
case tp: TypeRef if tp.info.isTypeAlias =>
66066606
apply(n, tp.superType)
66076607
case tp: TypeParamRef =>
6608-
apply(n, TypeComparer.bounds(tp))
6608+
val bounds = TypeComparer.bounds(tp)
6609+
val loSize = apply(n, bounds.lo)
6610+
val hiSize = apply(n, bounds.hi)
6611+
hiSize max loSize
66096612
case tp: LazyRef =>
66106613
if seen.contains(tp) then n
66116614
else

tests/pos/i24007.scala

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
sealed trait CaseSet:
2+
type EnumType
3+
4+
object CaseSet {
5+
def caseOf[A, Z >: A]: Cons[A, Empty[Z], Z] = ???
6+
type Aux[EnumType0] = CaseSet { type EnumType = EnumType0 }
7+
8+
final class Empty[Z] extends CaseSet:
9+
type EnumType = Z
10+
11+
final class Cons[A, +T <: CaseSet.Aux[Z], Z](head: A, tail: T) extends CaseSet:
12+
type EnumType = Z
13+
def ++[That](that: That)(implicit append: Append[Z, Cons[A, T, Z], That]): append.Out = ???
14+
}
15+
16+
sealed trait Append[EnumType, -Left, -Right]:
17+
type Out <: CaseSet.Aux[EnumType]
18+
19+
object Append:
20+
type WithOut[EnumType, Left, Right, Out0] = Append[EnumType, Left, Right] { type Out = Out0 }
21+
22+
implicit def AppendCons[A, Z, T <: CaseSet.Aux[Z], That <: CaseSet.Aux[Z]](implicit
23+
append: Append[Z, T, That]
24+
): Append.WithOut[Z, CaseSet.Cons[A, T, Z], That, CaseSet.Cons[A, append.Out, Z]] = ???
25+
26+
implicit def AppendEmptyLeft[T <: CaseSet.Aux[Z], Z]: Append.WithOut[Z, CaseSet.Empty[Z], T, T] =
27+
???
28+
29+
object Test:
30+
type UnionValue = Int | Boolean | String
31+
val _ = CaseSet.caseOf[Int, UnionValue] ++
32+
CaseSet.caseOf[Boolean, UnionValue] ++
33+
CaseSet.caseOf[String, UnionValue]

0 commit comments

Comments
 (0)