Skip to content

Commit 763e0c0

Browse files
committed
Disable checkInst in RecType
It can give false negatives.
1 parent c04683b commit 763e0c0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,16 +2180,20 @@ object Types {
21802180
}
21812181

21822182
object RecType {
2183+
/* Note: this might well fail for nested Recs.
2184+
* Failing scenario: Rebind a nest rec, creates a new rec
2185+
* but it still has RecThis references to the outer rec.
21832186
def checkInst(tp: Type)(implicit ctx: Context): tp.type = {
21842187
var binders: List[RecType] = Nil
21852188
tp.foreachPart {
21862189
case rt: RecType => binders = rt :: binders
2187-
case rt: RecThis => assert(binders contains rt.binder, tp)
2190+
case rt: RecThis => assert(binders contains rt.binder)
21882191
case _ =>
21892192
}
21902193
tp
21912194
}
2192-
def apply(parentExp: RecType => Type)(implicit ctx: Context): RecType = checkInst {
2195+
*/
2196+
def apply(parentExp: RecType => Type)(implicit ctx: Context): RecType = {
21932197
var rt = new RecType(parentExp)
21942198
rt.parent match {
21952199
case rt2: RecType =>
@@ -2198,7 +2202,7 @@ object Types {
21982202
}
21992203
unique(rt)
22002204
}
2201-
def closeOver(parentExp: RecType => Type)(implicit ctx: Context) = checkInst {
2205+
def closeOver(parentExp: RecType => Type)(implicit ctx: Context) = {
22022206
val rt = this(parentExp)
22032207
//val self = RecThis(rt)
22042208
def isSelfRef(t: Type) = t match {

0 commit comments

Comments
 (0)