Open GavinRay97 opened 3 years ago
Self-contained minimization:
public interface WebTestClient {
interface ResponseSpec {
<B> BodySpec<B, ?> expectBody(Class<B> bodyType);
}
interface BodySpec<B, S extends BodySpec<B, S>> {
<T extends S> T isEqualTo(B expected);
}
}
object Test {
def test(r: WebTestClient.ResponseSpec): Unit =
r.expectBody(classOf[String]).isEqualTo("Hello world!")
}
$ javac -version && dotc -version
javac 1.8.0_292
Scala compiler version 3.0.2-RC1-bin-SNAPSHOT-git-0e533b0 -- Copyright 2002-2021, LAMP/EPFL
$ javac -d out WebTestClient.java
$ dotc -Yforce-sbt-phases -classpath out Test.scala
java.lang.StackOverflowError while compiling Test.scala
Exception in thread "main" java.lang.StackOverflowError
at dotty.tools.dotc.core.Hashable.typeHash(Hashable.scala:47)
at dotty.tools.dotc.core.Hashable.typeHash$(Hashable.scala:38)
at dotty.tools.dotc.core.Uniques$AppliedUniques.typeHash(Uniques.scala:56)
at dotty.tools.dotc.core.Hashable.finishHash(Hashable.scala:78)
at dotty.tools.dotc.core.Hashable.finishHash$(Hashable.scala:38)
at dotty.tools.dotc.core.Uniques$AppliedUniques.finishHash(Uniques.scala:56)
at dotty.tools.dotc.core.Hashable.doHash(Hashable.scala:106)
at dotty.tools.dotc.core.Hashable.doHash$(Hashable.scala:38)
at dotty.tools.dotc.core.Uniques$AppliedUniques.doHash(Uniques.scala:56)
at dotty.tools.dotc.core.Uniques$AppliedUniques.enterIfNew(Uniques.scala:60)
at dotty.tools.dotc.core.Types$AppliedType$.apply(Types.scala:4254)
at dotty.tools.dotc.core.TypeApplications$.appliedTo$extension(TypeApplications.scala:372)
at dotty.tools.dotc.core.Types$AppliedType.derivedAppliedType(Types.scala:4228)
at dotty.tools.dotc.core.Types$TypeMap.derivedAppliedType(Types.scala:5275)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5337)
at dotty.tools.dotc.core.Substituters$.subst2(Substituters.scala:52)
at dotty.tools.dotc.core.Substituters$Subst2Map.apply(Substituters.scala:173)
at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5349)
at dotty.tools.dotc.core.Substituters$.subst2(Substituters.scala:52)
at dotty.tools.dotc.core.Types$Type.subst(Types.scala:1728)
at dotty.tools.dotc.core.Types$NamedType.rebase$1(Types.scala:2274)
at dotty.tools.dotc.core.Types$NamedType.argDenot(Types.scala:2285)
at dotty.tools.dotc.core.Types$NamedType.fromDesignator$1(Types.scala:2210)
at dotty.tools.dotc.core.Types$NamedType.computeDenot(Types.scala:2228)
at dotty.tools.dotc.core.Types$NamedType.denot(Types.scala:2183)
at dotty.tools.dotc.core.Types$NamedType.info(Types.scala:2171)
at dotty.tools.dotc.sbt.ExtractDependenciesCollector$TypeDependencyTraverser.traverse(ExtractDependencies.scala:459)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:5859)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:5859)
at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:5843)
at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:5860)
at dotty.tools.dotc.sbt.ExtractDependenciesCollector$TypeDependencyTraverser.traverse(ExtractDependencies.scala:469)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:5859)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:5859)
at dotty.tools.dotc.core.Types$TypeAccumulator.op$proxy23$1(Types.scala:5773)
at dotty.tools.dotc.core.Types$TypeAccumulator.foldArgs$1(Types.scala:5773)
at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:5777)
at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:5860)
at dotty.tools.dotc.sbt.ExtractDependenciesCollector$TypeDependencyTraverser.traverse(ExtractDependencies.scala:469)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:5859)
at dotty.tools.dotc.core.Types$TypeTraverser.apply(Types.scala:5859)
at dotty.tools.dotc.core.Types$TypeAccumulator.foldOver(Types.scala:5804)
at dotty.tools.dotc.core.Types$TypeTraverser.traverseChildren(Types.scala:5860)
... truncated ...
I'm going to guess it's the f-bounds that causing the cycle.
The minimized example seems to compile as it should using Scala 3.5.0.
(Found this issue while trying to track down another Java-related issue with some weird bounds, was hoping it might be related, but doesn't seem like it).
Compiler version
3.0.0
Minimized code
Output (click arrow to expand)
It's the below error, repeated hundreds of times in a cyclical loop.