aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-21 09:28:22 +0100
committerMartin Odersky <odersky@gmail.com>2017-02-21 09:28:30 +0100
commit5f9e569926728e7f591a26729efa7700387aeb22 (patch)
tree435f8bc107e8def412ce00aef5fbc4d633ac1f53 /compiler/src/dotty/tools/dotc/typer/Typer.scala
parentf467be62da8978e506f58b702b84e74ef7ce09de (diff)
downloaddotty-5f9e569926728e7f591a26729efa7700387aeb22.tar.gz
dotty-5f9e569926728e7f591a26729efa7700387aeb22.tar.bz2
dotty-5f9e569926728e7f591a26729efa7700387aeb22.zip
Don't inline when errors are detected
Inlining is only well-defined if the body to inline does not have any errors. We therefore check for errors before we perform any transformation of trees related to inlining. The error check is global, i.e. we stop on any error not just on errors in the code to be inlined. This is a safe approximation, of course.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Typer.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala
index 498fd001b..26f7bc65b 100644
--- a/compiler/src/dotty/tools/dotc/typer/Typer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala
@@ -1964,7 +1964,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
if (Inliner.hasBodyToInline(tree.symbol) &&
!ctx.owner.ownersIterator.exists(_.isInlineMethod) &&
!ctx.settings.YnoInline.value &&
- !ctx.isAfterTyper)
+ !ctx.isAfterTyper &&
+ !ctx.reporter.hasErrors)
adapt(Inliner.inlineCall(tree, pt), pt)
else if (ctx.typeComparer.GADTused && pt.isValueType)
// Insert an explicit cast, so that -Ycheck in later phases succeeds.