Skip to content

Commit 95ae793

Browse files
authored
Merge pull request #15072 from dotty-staging/fix-14679
Properly look for inline methods
2 parents b40b9de + e611b33 commit 95ae793

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ trait QuotesAndSplices {
167167
assignType(tree, tpt)
168168

169169
private def checkSpliceOutsideQuote(tree: untpd.Tree)(using Context): Unit =
170-
if (level == 0 && !ctx.owner.ownersIterator.exists(_.is(Inline)))
170+
if (level == 0 && !ctx.owner.ownersIterator.exists(_.isInlineMethod))
171171
report.error("Splice ${...} outside quotes '{...} or inline method", tree.srcPos)
172172
else if (level < 0)
173173
report.error(

tests/neg-macros/i14679.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import scala.quoted.*
2+
3+
object A {
4+
inline val a = ${b} // error
5+
6+
def b(using Quotes): Expr[Unit] = '{ () }
7+
}

0 commit comments

Comments
 (0)