diff options
-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 +} |