question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StackOverflow in typer

See original GitHub issue
trait X {
  type A = B
  type B
}
trait Y {
  type A
  type B = A
}
trait Z extends X with Y
Exception in thread "main" java.lang.StackOverflowError
	at java.lang.invoke.MemberName.getInvocationType(MemberName.java:164)
	at java.lang.invoke.DirectMethodHandle.preparedLambdaForm(DirectMethodHandle.java:167)
	at java.lang.invoke.DirectMethodHandle.make(DirectMethodHandle.java:89)
	at java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(MethodHandles.java:1660)
	at java.lang.invoke.MethodHandles$Lookup.getDirectMethodNoSecurityManager(MethodHandles.java:1617)
	at java.lang.invoke.MethodHandles$Lookup.getDirectMethodForConstant(MethodHandles.java:1802)
	at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:1751)
	at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:477)
	at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:661)
	at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:491)
	at dotty.tools.dotc.core.Types$Type.$anonfun$nonPrivateMember$1(Types.scala:482)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.Types$Type.nonPrivateMember(Types.scala:482)
	at dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:1777)
	at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2025)
	at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2037)
	at dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:1997)
	at dotty.tools.dotc.core.Types$TypeMap.derivedSelect(Types.scala:3902)
	at dotty.tools.dotc.core.Types$ApproximatingTypeMap.derivedSelect(Types.scala:4174)
	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.$anonfun$mapOver$7(Types.scala:3974)
	at dotty.tools.dotc.core.Types$VariantTraversal.atVariance(Types.scala:3888)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3974)
	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)
	at dotty.tools.dotc.core.TypeOps.asSeenFrom$(TypeOps.scala:27)
	at dotty.tools.dotc.core.Contexts$Context.asSeenFrom(Contexts.scala:71)
	at dotty.tools.dotc.core.Types$Type.$anonfun$asSeenFrom$1(Types.scala:767)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.Types$Type.asSeenFrom(Types.scala:766)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:1075)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.computeAsSeenFrom(Denotations.scala:660)
	at dotty.tools.dotc.core.Denotations$PreDenotation.asSeenFrom(Denotations.scala:131)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.mapInherited(Denotations.scala:1062)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.mapInherited(Denotations.scala:660)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.collect$1(SymDenotations.scala:1605)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.collect$1(SymDenotations.scala:1600)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.collect$1(SymDenotations.scala:1600)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.$anonfun$computeNPMembersNamed$1(SymDenotations.scala:1613)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeNPMembersNamed(SymDenotations.scala:1592)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.nonPrivateMembersNamed(SymDenotations.scala:1582)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.findMember(SymDenotations.scala:1617)
	at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:509)
	at dotty.tools.dotc.core.Types$Type.goThis$1(Types.scala:613)
	at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:522)
	at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:658)
	at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:491)
	at dotty.tools.dotc.core.Types$Type.$anonfun$nonPrivateMember$1(Types.scala:482)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.core.Types$Type.nonPrivateMember(Types.scala:482)
	at dotty.tools.dotc.core.Types$NamedType.memberDenot(Types.scala:1777)
	at dotty.tools.dotc.core.Types$NamedType.reload$1(Types.scala:2025)
	at dotty.tools.dotc.core.Types$NamedType.withPrefix(Types.scala:2037)
	at dotty.tools.dotc.core.Types$NamedType.derivedSelect(Types.scala:1997)
	at dotty.tools.dotc.core.Types$TypeMap.derivedSelect(Types.scala:3902)
	at dotty.tools.dotc.core.Types$ApproximatingTypeMap.derivedSelect(Types.scala:4174)
	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.$anonfun$mapOver$7(Types.scala:3974)
	at dotty.tools.dotc.core.Types$VariantTraversal.atVariance(Types.scala:3888)
	at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:3974)
	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)
.......

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
smartercommented, Apr 25, 2018

Looks like a duplicate of one of the oldest issue still open: https://github.com/lampepfl/dotty/issues/318

0reactions
Blaisorbladecommented, Apr 25, 2018

https://github.com/scala/bug/issues/10846 reports quite a few examples also stack overflow there. The last one fails due to volatility checks:

trait W {
  type A
}
trait X extends W {
  type A = B
  type B
}
trait Y extends W {
  type A
  type B = A
}

trait Foo[X <: W, Y <: W] {
  type Z = X with Y
  val z: Z
  val a: z.A
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

User Tyler - Stack Overflow
Tyler is a Solutions Architect at a software services firm in Portland. He spends a lot of time in the Microsoft tech stack....
Read more >
Tyler McEntee - Software Developer, Public Platform - LinkedIn
Tyler McEntee is software developer living in the Midwest. He has professional interests in machine learning and data science.
Read more >
Tyler McGinnis on Twitter: "Interesting chart with Stack Overflow ...
Interesting chart with Stack Overflow Trends. Not perfect, but feels much more reliable than Google Trends. https://insights.stackoverflow.com/trends?utm_source ...
Read more >
Stack for Stack Overflow - Apps on Google Play
Stack is powered by Stack Overflow and other Stack Exchange sites. Search and filter through questions to find the exact answer you're looking...
Read more >
Tyler Wong tylerbwong - GitHub
An Android app for browsing Stack Overflow and other Stack Exchange sites. ... A Gradle plugin for Metalava, AOSP's tool for API metadata...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found