Skip to content

Commit 59de925

Browse files
Merge pull request #13 from scala/backport-lts-3.3-21699
Backport "Fix incorrect caching with dependent method parameters" to LTS
2 parents 4908534 + 4b90cf3 commit 59de925

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

+3
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ object Types extends TypeUtils {
140140
!t.isPermanentlyInstantiated || test(t.permanentInst, theAcc)
141141
case t: LazyRef =>
142142
!t.completed || test(t.ref, theAcc)
143+
case t: ParamRef =>
144+
(t: Type).mightBeProvisional = false // break cycles
145+
test(t.underlying, theAcc)
143146
case _ =>
144147
(if theAcc != null then theAcc else ProAcc()).foldOver(false, t)
145148
end if

tests/pos/dep-poly-class.scala

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
trait A:
2+
type B
3+
4+
class CCPoly[T <: A](a: T, b: a.B)
5+
6+
object Test:
7+
def test(): Unit =
8+
val aa: A { type B = Int } = new A { type B = Int }
9+
val x: CCPoly[aa.type] = CCPoly(aa, 1)

0 commit comments

Comments
 (0)