Skip to content

Commit

Permalink
Merge pull request #15072 from dotty-staging/fix-14679
Browse files Browse the repository at this point in the history
Properly look for inline methods
  • Loading branch information
mbovel authored May 30, 2022
2 parents b40b9de + e611b33 commit 95ae793
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/QuotesAndSplices.scala
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ trait QuotesAndSplices {
assignType(tree, tpt)

private def checkSpliceOutsideQuote(tree: untpd.Tree)(using Context): Unit =
if (level == 0 && !ctx.owner.ownersIterator.exists(_.is(Inline)))
if (level == 0 && !ctx.owner.ownersIterator.exists(_.isInlineMethod))
report.error("Splice ${...} outside quotes '{...} or inline method", tree.srcPos)
else if (level < 0)
report.error(
Expand Down
7 changes: 7 additions & 0 deletions tests/neg-macros/i14679.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import scala.quoted.*

object A {
inline val a = ${b} // error

def b(using Quotes): Expr[Unit] = '{ () }
}

0 comments on commit 95ae793

Please sign in to comment.