diff --git a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala index 6120ed356805..4954f1f9dcaa 100644 --- a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala +++ b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala @@ -314,7 +314,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic { // Precondition: !isSubType(tp1, tp2) && !isSubType(tp2, tp1). if (!ctx.explicitNulls && (tp1.isNullType || tp2.isNullType)) { // Since projections of types don't include null, intersection with null is empty. - return Empty + Empty } else { val res = ctx.typeComparer.provablyDisjoint(tp1, tp2) diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index b795ab296467..c8a3ebe593e7 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -2826,7 +2826,8 @@ class Typer extends Namer tree.tpe <:< wildApprox(pt) val errorCount = ctx.reporter.errorCount val inlined = Inliner.inlineCall(tree) - if (errorCount == ctx.reporter.errorCount) readaptSimplified(inlined) else inlined + if ((inlined ne tree) && errorCount == ctx.reporter.errorCount) readaptSimplified(inlined) + else inlined } else if (tree.symbol.isScala2Macro && // raw and s are eliminated by the StringInterpolatorOpt phase diff --git a/tests/neg/i7758.scala b/tests/neg/i7758.scala new file mode 100644 index 000000000000..5b0af7efa8be --- /dev/null +++ b/tests/neg/i7758.scala @@ -0,0 +1 @@ +def f: Int = implicitly: Int // error \ No newline at end of file