Skip to content

Crash after error #4653

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
nicolasstucki opened this issue Jun 13, 2018 · 0 comments
Closed

Crash after error #4653

nicolasstucki opened this issue Jun 13, 2018 · 0 comments

Comments

@nicolasstucki
Copy link
Contributor

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)
	... 
liufengyun added a commit that referenced this issue Jul 30, 2018
Fix #4653: check method return type is value type
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

1 participant