From 91d9cc3b160bebcec0cd11ca4382a21fd6d02a6d Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 17 Feb 2021 13:45:34 +0100 Subject: [PATCH] Remove transparent when dropping inline Fixes #11437 --- compiler/src/dotty/tools/dotc/typer/PrepareInlineable.scala | 1 + tests/neg/i11437.check | 6 ++++++ tests/neg/i11437.scala | 1 + 3 files changed, 8 insertions(+) create mode 100644 tests/neg/i11437.check create mode 100644 tests/neg/i11437.scala diff --git a/compiler/src/dotty/tools/dotc/typer/PrepareInlineable.scala b/compiler/src/dotty/tools/dotc/typer/PrepareInlineable.scala index 84ff8790f94d..56d89f982869 100644 --- a/compiler/src/dotty/tools/dotc/typer/PrepareInlineable.scala +++ b/compiler/src/dotty/tools/dotc/typer/PrepareInlineable.scala @@ -224,6 +224,7 @@ object PrepareInlineable { finally if ctx.reporter.errorCount != initialErrorCount then sym.resetFlag(Inline) + sym.resetFlag(Transparent) sym.removeAnnotation(defn.BodyAnnot) /** Register inline info for given inlineable method `sym`. diff --git a/tests/neg/i11437.check b/tests/neg/i11437.check new file mode 100644 index 000000000000..f327d6a6a8d2 --- /dev/null +++ b/tests/neg/i11437.check @@ -0,0 +1,6 @@ +-- [E006] Not Found Error: tests/neg/i11437.scala:1:29 ----------------------------------------------------------------- +1 |transparent inline def foo = error // error + | ^^^^^ + | Not found: error + +longer explanation available when compiling with `-explain` diff --git a/tests/neg/i11437.scala b/tests/neg/i11437.scala new file mode 100644 index 000000000000..b9e29d8d4fda --- /dev/null +++ b/tests/neg/i11437.scala @@ -0,0 +1 @@ +transparent inline def foo = error // error