diff --git a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala b/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala index 479e3e0fad5e..ae9d63c3c222 100644 --- a/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala +++ b/compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala @@ -245,7 +245,7 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer { l == level || sym.is(Inline) && sym.owner.is(Macro) && sym.info.isValueType && l - 1 == level case None => - level == 0 + !sym.is(Param) || levelOK(sym.owner) } /** Issue a "splice outside quote" error unless we ar in the body of an inline method */ diff --git a/tests/pos/i4396a.scala b/tests/pos/i4396a.scala new file mode 100644 index 000000000000..0a69f685f986 --- /dev/null +++ b/tests/pos/i4396a.scala @@ -0,0 +1,3 @@ +class Test { + '(Option(4) match { case Some(a) => a; case None => 1 }) +} \ No newline at end of file diff --git a/tests/pos/i4396b.scala b/tests/pos/i4396b.scala new file mode 100644 index 000000000000..ec327cfa61c1 --- /dev/null +++ b/tests/pos/i4396b.scala @@ -0,0 +1,3 @@ +class Test { + '{ case class Foo() } +} \ No newline at end of file