Skip to content

MatchError in erasure #4247

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 Apr 5, 2018 · 1 comment
Closed

MatchError in erasure #4247

sir-wabbit opened this issue Apr 5, 2018 · 1 comment

Comments

@sir-wabbit
Copy link

class Foo[U] { self : Array[U] & Nothing =>
  val s = self(0)
}
Exception in thread "main" scala.MatchError: TypeRef(ThisType(TypeRef(NoPrefix,module class <empty>)),class Foo) (of class dotty.tools.dotc.core.Types$CachedTypeRef)
	at dotty.tools.dotc.typer.TypeAssigner.arrayElemType$1(TypeAssigner.scala:274)
	at dotty.tools.dotc.typer.TypeAssigner.assignType(TypeAssigner.scala:279)
	at dotty.tools.dotc.typer.TypeAssigner.assignType$(TypeAssigner.scala:271)
	at dotty.tools.dotc.typer.Typer.assignType(Typer.scala:83)
	at dotty.tools.dotc.transform.Erasure$Typer.selectArrayMember$1(Erasure.scala:408)
	at dotty.tools.dotc.transform.Erasure$Typer.recur$1(Erasure.scala:430)
	at dotty.tools.dotc.transform.Erasure$Typer.typedSelect(Erasure.scala:440)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1758)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1828)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:113)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1860)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1856)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1868)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1928)
	at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:488)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1777)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1829)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:113)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1860)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1856)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1868)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1928)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedDefDef$1(Typer.scala:1428)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1410)
	at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:571)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1765)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1828)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:113)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1860)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1856)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1868)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1887)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1916)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:678)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedClassDef$1(Typer.scala:1529)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1455)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1768)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1828)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:113)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1860)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1856)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1868)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1887)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1916)
	at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:678)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedPackageDef$1(Typer.scala:1636)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1627)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1808)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1829)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:113)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1860)
	at dotty.tools.dotc.reporting.trace$.op1$3(trace.scala:32)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:33)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1856)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1868)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1928)
	at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:99)
	at dotty.tools.dotc.core.Phases$Phase.$anonfun$runOn$1(Phases.scala:292)
	at scala.collection.immutable.List.map(List.scala:283)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:290)
	at dotty.tools.dotc.core.Phases$Phase.runOn$(Phases.scala:289)
	at dotty.tools.dotc.transform.Erasure.runOn(Erasure.scala:34)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$3(Run.scala:174)
@nicolasstucki
Copy link
Contributor

Minimizable to

class Foo[U] { self : Array[U] => self(0) }

@nicolasstucki nicolasstucki changed the title MatchError in typer MatchError in erasure Apr 5, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Apr 5, 2018
@nicolasstucki nicolasstucki self-assigned this Apr 5, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Apr 13, 2018
@nicolasstucki nicolasstucki removed their assignment Nov 27, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 9, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 9, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 9, 2020
nicolasstucki added a commit that referenced this issue Jan 9, 2020
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