Skip to content

Commit f54e7aa

Browse files
author
Aggelos Biboudis
authored
Merge pull request #4413 from dotty-staging/fix-#4396
Fix #4396: Check level of owners of type parameters
2 parents cdbb1be + 16d2a4f commit f54e7aa

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
245245
l == level ||
246246
sym.is(Inline) && sym.owner.is(Macro) && sym.info.isValueType && l - 1 == level
247247
case None =>
248-
level == 0
248+
!sym.is(Param) || levelOK(sym.owner)
249249
}
250250

251251
/** Issue a "splice outside quote" error unless we ar in the body of an inline method */

tests/pos/i4396a.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Test {
2+
'(Option(4) match { case Some(a) => a; case None => 1 })
3+
}

tests/pos/i4396b.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Test {
2+
'{ case class Foo() }
3+
}

0 commit comments

Comments
 (0)