Skip to content

[compiler crash][regression] problems with upper-bounded abstract types - type T >: this.type + correct recursive generics #5876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ibaklan opened this issue Feb 8, 2019 · 1 comment

Comments

@ibaklan
Copy link

ibaklan commented Feb 8, 2019

When trying to define HasThisType trait in following form

    // this is compile-able code in both Scala and Dotty compilers
    type HasThisTypeLoverBounded[PThis] = HasThisType { type This <: PThis }
    trait HasThisType {
      type This >: this.type <: HasThisTypeLoverBounded[This]
    }

Dotty compiler crashes when that snippet is grown to several bigger snippets.

(1) While attempting to verify that "that.This#This <: that.This" like
(complete snippet, same snippet with commented problematic lines)

      val that: HasThisType = ???
      // this line works in both Dotty and Scala
      val that1: that.This = that

      // this like fails in both Dotty and Scala but in Dotty it also makes compiler runtime crash
      val that2: that1.This = that1

(2) While trying to define abstract subclass with qualities similar to original HasThisType:
(complete snippet)

    // this code is compile-able in Scala while in Dotty it makes compiler runtime crash
    type FooLikeTypeLoverBounded[PThis] = FooLike { type This <: PThis }
    class FooLike extends HasThisType {
      type This >: this.type <: FooLikeTypeLoverBounded[This]
    }

However simple instantiation/subclassing of such HasThisType is still possible in Dotty:
(complete snippet)

    // this code is compile-able in both Scala and Dotty compiler
    class Foo extends HasThisType {
      type This = Foo
    }

FYI: positive case (snippet which compiles and works as expected with Scala compiler)
could be found here

@OlivierBlanvillain
Copy link
Contributor

OlivierBlanvillain commented Feb 8, 2019

Assertion error minimized to:

type HasThisB[T] = HasThis { type This <: T }
trait HasThis {
  type This >: this.type <: HasThisB[This]
}

type FB[T] = F { type This <: T }
class F extends HasThis {
  type This >: this.type <: FB[This]
}
stacktrace

Exception in thread "main" java.lang.AssertionError: assertion failed
        at dotty.DottyPredef$.assertFail(DottyPredef.scala:37)
        at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:2402)
        at dotty.tools.dotc.core.TypeComparer$$anon$1.apply(TypeComparer.scala:166)
        at dotty.tools.dotc.core.Types$TypeMap.mapArgs$1(Types.scala:4358)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:4366)
        at dotty.tools.dotc.core.TypeComparer$$anon$1.apply(TypeComparer.scala:168)
        at dotty.tools.dotc.core.TypeComparer.monitoredIsSubType$1(TypeComparer.scala:171)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:185)
        at dotty.tools.dotc.core.Types$Type.frozen_$less$colon$less(Types.scala:831)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3950)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3959)
        at dotty.tools.dotc.core.Types$Type.recoverable_$amp(Types.scala:935)
        at dotty.tools.dotc.core.Types$Type.goRefined$1(Types.scala:647)
        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:569)
        at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:702)
        at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:532)
        at dotty.tools.dotc.core.Types$Type.nonPrivateMember(Types.scala:523)
        at dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:1858)
        at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2139)
        at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2151)
        at dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:2092)
        at dotty.tools.dotc.core.Types$TypeMap.derivedSelect(Types.scala:4298)
        at dotty.tools.dotc.core.Types$ApproximatingTypeMap.derivedSelect(Types.scala:4582)
        at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:57)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:4403)
        at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:2405)
        at dotty.tools.dotc.core.TypeComparer$$anon$1.apply(TypeComparer.scala:166)
        at dotty.tools.dotc.core.Types$TypeMap.mapArgs$1(Types.scala:4358)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:4366)
        at dotty.tools.dotc.core.TypeComparer$$anon$1.apply(TypeComparer.scala:168)
        at dotty.tools.dotc.core.TypeComparer.monitoredIsSubType$1(TypeComparer.scala:171)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:185)
        at dotty.tools.dotc.core.Types$Type.frozen_$less$colon$less(Types.scala:831)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3950)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3959)
        at dotty.tools.dotc.core.Types$Type.recoverable_$amp(Types.scala:935)
        at dotty.tools.dotc.core.Types$Type.goRefined$1(Types.scala:647)
        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:569)
        at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:702)
        at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:532)
        at dotty.tools.dotc.core.Types$Type.nonPrivateMember(Types.scala:523)
        at dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:1858)
        at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2139)
        at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2151)
        at dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:2092)
        at dotty.tools.dotc.core.Types$TypeMap.derivedSelect(Types.scala:4298)
        at dotty.tools.dotc.core.Types$ApproximatingTypeMap.derivedSelect(Types.scala:4582)
        at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:57)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:4403)
        at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:2405)
        at dotty.tools.dotc.core.TypeComparer$$anon$1.apply(TypeComparer.scala:166)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:4378)
        at dotty.tools.dotc.core.TypeComparer$$anon$1.apply(TypeComparer.scala:168)
        at dotty.tools.dotc.core.TypeComparer.monitoredIsSubType$1(TypeComparer.scala:171)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.qualifies$1(TypeComparer.scala:1137)
        at dotty.tools.dotc.core.TypeComparer.hasMatchingMember(TypeComparer.scala:1140)
        at dotty.tools.dotc.core.TypeComparer.compareRefinedSlow$1(TypeComparer.scala:455)
        at dotty.tools.dotc.core.TypeComparer.compareRefined$1(TypeComparer.scala:471)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:477)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.compareLower$1(TypeComparer.scala:835)
        at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:851)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:428)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:364)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:185)
        at dotty.tools.dotc.core.TypeComparer.dropIfSuper(TypeComparer.scala:1497)
        at dotty.tools.dotc.core.TypeComparer.glb(TypeComparer.scala:1368)
        at dotty.tools.dotc.core.Types$Type.$amp(Types.scala:915)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3951)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3959)
        at dotty.tools.dotc.core.Types$Type.recoverable_$amp(Types.scala:935)
        at dotty.tools.dotc.core.Types$Type.goRefined$1(Types.scala:647)
        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:569)
        at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:702)
        at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:532)
        at dotty.tools.dotc.core.Types$Type.nonPrivateMember(Types.scala:523)
        at dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:1858)
        at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2139)
        at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2151)
        at dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:2092)
        at dotty.tools.dotc.core.Types$TypeMap.derivedSelect(Types.scala:4298)
        at dotty.tools.dotc.core.Types$ApproximatingTypeMap.derivedSelect(Types.scala:4582)
        at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:57)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:4403)
        at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:2405)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:246)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.compareTypeBounds$1(TypeComparer.scala:591)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:597)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.qualifies$1(TypeComparer.scala:1137)
        at dotty.tools.dotc.core.TypeComparer.hasMatchingMember(TypeComparer.scala:1140)
        at dotty.tools.dotc.core.TypeComparer.compareRefinedSlow$1(TypeComparer.scala:455)
        at dotty.tools.dotc.core.TypeComparer.compareRefined$1(TypeComparer.scala:471)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:477)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.compareLower$1(TypeComparer.scala:835)
        at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:851)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:428)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:364)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:185)
        at dotty.tools.dotc.core.TypeComparer.dropIfSuper(TypeComparer.scala:1497)
        at dotty.tools.dotc.core.TypeComparer.glb(TypeComparer.scala:1368)
        at dotty.tools.dotc.core.Types$Type.$amp(Types.scala:915)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3951)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3959)
        at dotty.tools.dotc.core.Types$Type.recoverable_$amp(Types.scala:935)
        at dotty.tools.dotc.core.Types$Type.goRefined$1(Types.scala:647)
        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:569)
        at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:702)
        at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:532)
        at dotty.tools.dotc.core.Types$Type.nonPrivateMember(Types.scala:523)
        at dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:1858)
        at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2139)
        at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2151)
        at dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:2092)
        at dotty.tools.dotc.core.Types$TypeMap.derivedSelect(Types.scala:4298)
        at dotty.tools.dotc.core.Types$ApproximatingTypeMap.derivedSelect(Types.scala:4582)
        at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:57)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:4403)
        at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:2405)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:246)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.compareTypeBounds$1(TypeComparer.scala:591)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:597)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.qualifies$1(TypeComparer.scala:1137)
        at dotty.tools.dotc.core.TypeComparer.hasMatchingMember(TypeComparer.scala:1140)
        at dotty.tools.dotc.core.TypeComparer.compareRefinedSlow$1(TypeComparer.scala:455)
        at dotty.tools.dotc.core.TypeComparer.compareRefined$1(TypeComparer.scala:471)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:477)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.compareLower$1(TypeComparer.scala:835)
        at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:851)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:428)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:364)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:185)
        at dotty.tools.dotc.core.TypeComparer.dropIfSuper(TypeComparer.scala:1497)
        at dotty.tools.dotc.core.TypeComparer.glb(TypeComparer.scala:1368)
        at dotty.tools.dotc.core.Types$Type.$amp(Types.scala:915)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3951)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3959)
        at dotty.tools.dotc.core.Types$Type.recoverable_$amp(Types.scala:935)
        at dotty.tools.dotc.core.Types$Type.goRefined$1(Types.scala:647)
        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:569)
        at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:702)
        at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:532)
        at dotty.tools.dotc.core.Types$Type.nonPrivateMember(Types.scala:523)
        at dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:1858)
        at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2139)
        at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2151)
        at dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:2092)
        at dotty.tools.dotc.core.Types$TypeMap.derivedSelect(Types.scala:4298)
        at dotty.tools.dotc.core.Types$ApproximatingTypeMap.derivedSelect(Types.scala:4582)
        at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:57)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:4403)
        at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:2405)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:246)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.compareTypeBounds$1(TypeComparer.scala:591)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:597)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.qualifies$1(TypeComparer.scala:1137)
        at dotty.tools.dotc.core.TypeComparer.hasMatchingMember(TypeComparer.scala:1140)
        at dotty.tools.dotc.core.TypeComparer.compareRefinedSlow$1(TypeComparer.scala:455)
        at dotty.tools.dotc.core.TypeComparer.compareRefined$1(TypeComparer.scala:471)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:477)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.compareLower$1(TypeComparer.scala:835)
        at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:851)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:428)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:364)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:185)
        at dotty.tools.dotc.core.TypeComparer.dropIfSuper(TypeComparer.scala:1497)
        at dotty.tools.dotc.core.TypeComparer.glb(TypeComparer.scala:1368)
        at dotty.tools.dotc.core.Types$Type.$amp(Types.scala:915)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3951)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3959)
        at dotty.tools.dotc.core.Types$Type.recoverable_$amp(Types.scala:935)
        at dotty.tools.dotc.core.Types$Type.goRefined$1(Types.scala:647)
        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:569)
        at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:702)
        at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:532)
        at dotty.tools.dotc.core.Types$Type.nonPrivateMember(Types.scala:523)
        at dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:1858)
        at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2139)
        at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2151)
        at dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:2092)
        at dotty.tools.dotc.core.Types$TypeMap.derivedSelect(Types.scala:4298)
        at dotty.tools.dotc.core.Types$ApproximatingTypeMap.derivedSelect(Types.scala:4582)
        at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:57)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:4403)
        at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:2405)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:246)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.compareTypeBounds$1(TypeComparer.scala:591)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:597)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.qualifies$1(TypeComparer.scala:1137)
        at dotty.tools.dotc.core.TypeComparer.hasMatchingMember(TypeComparer.scala:1140)
        at dotty.tools.dotc.core.TypeComparer.compareRefinedSlow$1(TypeComparer.scala:455)
        at dotty.tools.dotc.core.TypeComparer.compareRefined$1(TypeComparer.scala:471)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:477)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.compareLower$1(TypeComparer.scala:835)
        at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:851)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:428)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:364)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:185)
        at dotty.tools.dotc.core.TypeComparer.dropIfSuper(TypeComparer.scala:1497)
        at dotty.tools.dotc.core.TypeComparer.glb(TypeComparer.scala:1368)
        at dotty.tools.dotc.core.Types$Type.$amp(Types.scala:915)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3951)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3959)
        at dotty.tools.dotc.core.Types$Type.recoverable_$amp(Types.scala:935)
        at dotty.tools.dotc.core.Types$Type.goRefined$1(Types.scala:647)
        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:569)
        at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:702)
        at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:532)
        at dotty.tools.dotc.core.Types$Type.nonPrivateMember(Types.scala:523)
        at dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:1858)
        at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2139)
        at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2151)
        at dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:2092)
        at dotty.tools.dotc.core.Types$TypeMap.derivedSelect(Types.scala:4298)
        at dotty.tools.dotc.core.Types$ApproximatingTypeMap.derivedSelect(Types.scala:4582)
        at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:57)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver$$anonfun$1(Types.scala:4403)
        at dotty.tools.dotc.core.Types$LazyRef.ref(Types.scala:2405)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:246)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.compareTypeBounds$1(TypeComparer.scala:591)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:597)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.qualifies$1(TypeComparer.scala:1137)
        at dotty.tools.dotc.core.TypeComparer.hasMatchingMember(TypeComparer.scala:1140)
        at dotty.tools.dotc.core.TypeComparer.compareRefinedSlow$1(TypeComparer.scala:455)
        at dotty.tools.dotc.core.TypeComparer.compareRefined$1(TypeComparer.scala:471)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:477)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.compareLower$1(TypeComparer.scala:835)
        at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:851)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:428)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:319)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:364)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:185)
        at dotty.tools.dotc.core.TypeComparer.dropIfSuper(TypeComparer.scala:1497)
        at dotty.tools.dotc.core.TypeComparer.glb(TypeComparer.scala:1368)
        at dotty.tools.dotc.core.Types$Type.$amp(Types.scala:915)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3951)
        at dotty.tools.dotc.core.Types$TypeBounds.$amp(Types.scala:3959)
        at dotty.tools.dotc.core.Types$Type.recoverable_$amp(Types.scala:935)
        at dotty.tools.dotc.core.Types$Type.goRefined$1(Types.scala:647)
        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:569)
        at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:702)
        at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:532)
        at dotty.tools.dotc.core.Types$Type.member(Types.scala:518)
        at dotty.tools.dotc.core.TypeComparer.hasMatchingMember(TypeComparer.scala:1139)
        at dotty.tools.dotc.core.TypeComparer.compareRefinedSlow$1(TypeComparer.scala:455)
        at dotty.tools.dotc.core.TypeComparer.compareRefined$1(TypeComparer.scala:471)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:477)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.compareLower$1(TypeComparer.scala:835)
        at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:851)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:428)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.TypeComparer.compareTypeBounds$1(TypeComparer.scala:591)
        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:597)
        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)
        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:185)
        at dotty.tools.dotc.core.Types$Type.frozen_$less$colon$less(Types.scala:831)
        at dotty.tools.dotc.typer.RefChecks$.compatibleTypes$4(RefChecks.scala:274)
        at dotty.tools.dotc.typer.RefChecks$.checkOverride$1(RefChecks.scala:402)
        at dotty.tools.dotc.typer.RefChecks$.dotty$tools$dotc$typer$RefChecks$$$checkAllOverrides(RefChecks.scala:424)
        at dotty.tools.dotc.typer.RefChecks.transformTemplate(RefChecks.scala:979)
        at dotty.tools.dotc.transform.MegaPhase.goTemplate(MegaPhase.scala:967)
        at dotty.tools.dotc.transform.MegaPhase.goTemplate(MegaPhase.scala:968)
        at dotty.tools.dotc.transform.MegaPhase.goTemplate(MegaPhase.scala:968)
        at dotty.tools.dotc.transform.MegaPhase.goTemplate(MegaPhase.scala:968)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:340)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:392)
        at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:251)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:391)
        at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:400)
        at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:405)
        at scala.collection.immutable.List.mapConserve(List.scala:175)
        at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:405)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:339)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:392)
        at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:251)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:391)
        at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:400)
        at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:405)
        at scala.collection.immutable.List.mapConserve(List.scala:175)
        at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:405)
        at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:356)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:359)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:392)
        at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:411)
        at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:423)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:297)
        at scala.collection.immutable.List.map(List.scala:282)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:299)
        at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:172)
        at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
        at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
        at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
        at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:194)
        at dotty.tools.dotc.Run.runPhases$5(Run.scala:184)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:192)
        at scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:90)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:199)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:139)
        at dotty.tools.repl.ReplCompiler.runCompilationUnit(ReplCompiler.scala:141)
        at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:150)
        at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:213)
        at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:182)
        at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:127)
        at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:130)
        at dotty.tools.repl.ReplDriver.withRedirectedOutput$$anonfun$2$$anonfun$1(ReplDriver.scala:143)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
        at scala.Console$.withErr(Console.scala:192)
        at dotty.tools.repl.ReplDriver.withRedirectedOutput$$anonfun$1(ReplDriver.scala:143)
        at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
        at scala.Console$.withOut(Console.scala:163)
        at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:143)
        at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:130)
        at dotty.tools.repl.Main$.main(Main.scala:6)
        at dotty.tools.repl.Main.main(Main.scala)

odersky added a commit to dotty-staging/dotty that referenced this issue Mar 8, 2020
In monitoredIsSubType, don't dereference pending LazyRefs when normalizing a type to check whether
it is in the log of seen types.
@odersky odersky closed this as completed in 55d3501 Mar 8, 2020
odersky added a commit that referenced this issue Mar 8, 2020
Fix #5876: Don't dereference pending LazyRefs when normalizing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants