Skip to content

Crash after error  #4653

@nicolasstucki

Description

@nicolasstucki
object Numbers {
  def test(numbers: Numbers): Unit = {
    import numbers._
    def succDeco(succ: Nat): SuccAPI = new SuccAPI[Int](???)
    succDeco(null.asInstanceOf[Nat]).pred
  }
  class SuccAPI[X](val nums: Numbers) {
     def pred: nums.Nat = ???
  }
}
trait Numbers {
  type Nat
}

crashes the compiler after an error is emitted

-- [E056] Syntax Error: tests/run/fully-abstract-nat-8.scala:6:29 --------------
6 |    def succDeco(succ: Nat): SuccAPI = new SuccAPI[Int](???)
  |                             ^^^^^^^
  |                             missing type parameter for Numbers.SuccAPI
assertion failure for Numbers.SuccAPI <:< ?{ pred: ? }, frozen = false
exception occurred while typechecking tests/run/fully-abstract-nat-8.scala
exception occurred while compiling tests/run/fully-abstract-nat-8.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: invalid prefix HKTypeLambda(List(X), List(TypeBounds(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing),TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Any))), AppliedType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),module class Numbers$)),class SuccAPI),List(TypeParamRef(X))))
	at scala.Predef$.assert(Predef.scala:219)
	at dotty.tools.dotc.core.Types$NamedType.<init>(Types.scala:1592)
	at dotty.tools.dotc.core.Types$TermRef.<init>(Types.scala:2085)
	at dotty.tools.dotc.core.Types$CachedTermRef.<init>(Types.scala:2124)
	at dotty.tools.dotc.core.Uniques$NamedTypeUniques.newType$1(Uniques.scala:60)
	at dotty.tools.dotc.core.Uniques$NamedTypeUniques.enterIfNew(Uniques.scala:65)
	at dotty.tools.dotc.core.Types$TermRef$.apply(Types.scala:2155)
	at dotty.tools.dotc.core.Types$TermRef$.apply(Types.scala:2161)
	at dotty.tools.dotc.core.Types$NamedType$.apply(Types.scala:2147)
	at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2035)
	at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2042)
	at dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:2002)
	at dotty.tools.dotc.core.Types$TypeMap.derivedSelect(Types.scala:3925)
	at dotty.tools.dotc.core.Types$ApproximatingTypeMap.derivedSelect(Types.scala:4197)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.$anonfun$apply$4(TypeOps.scala:61)
	at dotty.tools.dotc.reporting.trace$.op1$1(trace.scala:18)
	at dotty.tools.dotc.reporting.trace$.conditionally(trace.scala:20)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:54)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.$anonfun$apply$5(TypeOps.scala:61)
	at dotty.tools.dotc.core.Types$VariantTraversal.atVariance(Types.scala:3911)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.$anonfun$apply$4(TypeOps.scala:61)
	at dotty.tools.dotc.reporting.trace$.op1$1(trace.scala:18)
	at dotty.tools.dotc.reporting.trace$.conditionally(trace.scala:20)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:54)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:4013)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.$anonfun$apply$4(TypeOps.scala:67)
	at dotty.tools.dotc.reporting.trace$.op1$1(trace.scala:18)
	at dotty.tools.dotc.reporting.trace$.conditionally(trace.scala:20)
	at dotty.tools.dotc.core.TypeOps$AsSeenFromMap.apply(TypeOps.scala:54)
	at dotty.tools.dotc.core.TypeOps.asSeenFrom(TypeOps.scala:28)
	... 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions