Skip to content

Commit e036f46

Browse files
Merge pull request #7764 from dotty-staging/fix-#7758
Fix #7758: Avoid stackoverflows after inline attempts
2 parents 0382f6b + 71e5545 commit e036f46

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
314314
// Precondition: !isSubType(tp1, tp2) && !isSubType(tp2, tp1).
315315
if (!ctx.explicitNulls && (tp1.isNullType || tp2.isNullType)) {
316316
// Since projections of types don't include null, intersection with null is empty.
317-
return Empty
317+
Empty
318318
}
319319
else {
320320
val res = ctx.typeComparer.provablyDisjoint(tp1, tp2)

compiler/src/dotty/tools/dotc/typer/Typer.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -2832,7 +2832,8 @@ class Typer extends Namer
28322832
tree.tpe <:< wildApprox(pt)
28332833
val errorCount = ctx.reporter.errorCount
28342834
val inlined = Inliner.inlineCall(tree)
2835-
if (errorCount == ctx.reporter.errorCount) readaptSimplified(inlined) else inlined
2835+
if ((inlined ne tree) && errorCount == ctx.reporter.errorCount) readaptSimplified(inlined)
2836+
else inlined
28362837
}
28372838
else if (tree.symbol.isScala2Macro &&
28382839
// raw and s are eliminated by the StringInterpolatorOpt phase

tests/neg/i7758.scala

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def f: Int = implicitly: Int // error

0 commit comments

Comments
 (0)