Skip to content

NoSuchElementException #5042

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
sir-wabbit opened this issue Aug 26, 2018 · 3 comments
Closed

NoSuchElementException #5042

sir-wabbit opened this issue Aug 26, 2018 · 3 comments

Comments

@sir-wabbit
Copy link

Here is a more sophisticated crash:

trait I0 {
  type I1[_, _]
  type I2[_]
  type I3[_]
  trait I4 { type I5 = I1[I2[Int], I3[Int]] }
  val I6: I4
  val I7 = new I0 {
    type I1[i8] = Int
    val I6 = new { def i9[I1[_]](i10: I1[Int]): I1[I5] = i10 }
  }
}
Exception in thread "main" java.util.NoSuchElementException: head of empty list
	at scala.collection.immutable.Nil$.head(List.scala:428)
	at scala.collection.immutable.Nil$.head(List.scala:425)
	at dotty.tools.dotc.core.Types$TypeAccumulator.foldArgs$1(Types.scala:4435)
	at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:4442)
	at dotty.tools.dotc.core.Types$$anon$5.apply(Types.scala:2867)
	at dotty.tools.dotc.core.Types$$anon$5.apply(Types.scala:2862)
	at dotty.tools.dotc.core.Types$$anon$5.apply(Types.scala:2853)
	at dotty.tools.dotc.core.Types$TypeAccumulator.foldArgs$1(Types.scala:4438)
	at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:4442)
	at dotty.tools.dotc.core.Types$$anon$5.apply(Types.scala:2867)
	at dotty.tools.dotc.core.Types$$anon$5.apply(Types.scala:2853)
	at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:4450)
	at dotty.tools.dotc.core.Types$$anon$5.apply(Types.scala:2867)
	at dotty.tools.dotc.core.Types$$anon$5.apply(Types.scala:2853)
	at dotty.tools.dotc.core.Types$TermLambda.dotty$tools$dotc$core$Types$TermLambda$$depStatus(Types.scala:2870)
	at dotty.tools.dotc.core.Types$TermLambda.dependencyStatus(Types.scala:2884)
	at dotty.tools.dotc.core.Types$TermLambda.resultType(Types.scala:2827)
	at dotty.tools.dotc.core.Types$MethodType.resultType(Types.scala:2931)
	at dotty.tools.dotc.core.Types$TypeMap.mapOverLambda$1(Types.scala:4084)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:4086)
	at dotty.tools.dotc.core.Substituters.subst(Substituters.scala:21)
	at dotty.tools.dotc.core.Types$Type.subst(Types.scala:1355)
	at dotty.tools.dotc.transform.FullParameterization.fullyParameterizedType$$anonfun$2(FullParameterization.scala:129)
	at dotty.tools.dotc.core.Types$PolyType.<init>(Types.scala:3127)
	at dotty.tools.dotc.core.Types$PolyType$.apply(Types.scala:3196)
	at dotty.tools.dotc.transform.FullParameterization.fullyParameterizedType(FullParameterization.scala:129)
	at dotty.tools.dotc.transform.TailRec.mkLabel(TailRec.scala:93)
	at dotty.tools.dotc.transform.TailRec.transformDefDef(TailRec.scala:107)
	at dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:892)
	at dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:893)
	at dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:893)
	at dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:893)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:247)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:380)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:389)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:394)

NSEE-d80fd1aafed9bbbd31b90a5ad3189cf20ce4aef8

@nicolasstucki
Copy link
Contributor

@sir-wabbit
Copy link
Author

New hash is NSEE-17f433fd8b72d31356d58b7477ba74b6fc5d93aa. Turns out that I should have removed $anon$ methods while hashing. Oh well.

@sir-wabbit
Copy link
Author

More examples:

trait i0 {
type i1[_, _]
type I2[_]
type i3[_]
trait i4 { type I5 = i1[I2[Int], i3[Int]] }
val I6: i4
val i7 = new i0 {
type i1[i7] = Int
I6 = new { def i7[i1[_]](i7: i1[Int]): i1[I5] = i7 }
}
}
trait I0 {
type i1[_, _]
type I2[_]
type I3[_]
type I5 = i1[I2[Int], I3[Int]]
val I5: I0 = new {
type i1[I0[_]] = Int
def I5[i1[_]](i1: i1[Int]): i1[I5] = i1
}
}
trait I0 {
type I0[_, _]
type i1[_]
type I2[_]
trait i3 {
type Type = I0[i1[Int], I2[Int]]
}
}
val I0: I0 = new {
type I0[I4[_]] = Int
val i3: i3 = new {
def I4[I0[_]](I4: I0[Int]): I0[Type] = I4
}
}

smarter added a commit to dotty-staging/dotty that referenced this issue Apr 30, 2019
@odersky odersky closed this as completed in 6491b48 May 2, 2019
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

3 participants