diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-10-18 16:15:40 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-11-07 13:12:53 +0100 |
commit | 98c6a0342f2903f8cbaf34e0f9a13be40916c7b4 (patch) | |
tree | 9db5c1c3eac58d28eb107947fdbc297eb4d30ef2 | |
parent | 5d590242132b0f38fc04afed2c787dadfd8d6c2f (diff) | |
download | dotty-98c6a0342f2903f8cbaf34e0f9a13be40916c7b4.tar.gz dotty-98c6a0342f2903f8cbaf34e0f9a13be40916c7b4.tar.bz2 dotty-98c6a0342f2903f8cbaf34e0f9a13be40916c7b4.zip |
Fix #1605: don't inline methods that have errors
-rw-r--r-- | src/dotty/tools/dotc/typer/Inliner.scala | 6 | ||||
-rw-r--r-- | tests/neg/i1605.scala | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Inliner.scala b/src/dotty/tools/dotc/typer/Inliner.scala index 4869b5e16..72a0158a5 100644 --- a/src/dotty/tools/dotc/typer/Inliner.scala +++ b/src/dotty/tools/dotc/typer/Inliner.scala @@ -146,7 +146,7 @@ object Inliner { addAccessor(tree, methPart, targs, argss, accessedType = methPart.tpe.widen, rhs = (qual, tps, argss) => qual.appliedToTypes(tps).appliedToArgss(argss)) - } else { + } else { // TODO: Handle references to non-public types. // This is quite tricky, as such types can appear anywhere, including as parts // of types of other things. For the moment we do nothing and complain @@ -191,7 +191,9 @@ object Inliner { sym.updateAnnotation(LazyBodyAnnotation { _ => implicit val ctx: Context = inlineCtx val tree1 = treeExpr(ctx) - makeInlineable(tree1) + if (tree1.hasType && !tree1.tpe.isError) + makeInlineable(tree1) + else tree1 }) } } diff --git a/tests/neg/i1605.scala b/tests/neg/i1605.scala new file mode 100644 index 000000000..776f2df47 --- /dev/null +++ b/tests/neg/i1605.scala @@ -0,0 +1,5 @@ +object Test { + def foo = inlineMe + + inline def inlineMe = 1 + x // error +} |