Skip to content

Commit 5d527bd

Browse files
Nicolas Stuckinicolasstucki
Nicolas Stucki
authored andcommitted
Fix quoted pattens with references to private fields
Reverts 0b072d6 Fixes #15676
1 parent f1bad54 commit 5d527bd

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-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
@@ -53,7 +53,7 @@ trait QuotesAndSplices {
5353
report.error(em"Quotes require stable Quotes, but found non stable $quotes", quotes.srcPos)
5454

5555
if ctx.mode.is(Mode.Pattern) then
56-
typedQuotePattern(tree, pt, quotes).withSpan(tree.span)
56+
makeInlineable(typedQuotePattern(tree, pt, quotes).withSpan(tree.span))
5757
else if tree.isTypeQuote then
5858
val msg = em"""Quoted types `'[..]` can only be used in patterns.
5959
|

tests/pos-macros/i15676/Macro_1.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package foo
2+
3+
import scala.quoted.*
4+
5+
private[foo] object Foo:
6+
def apply(): Int = ???
7+
8+
inline def test(): Unit = ${ testExpr() }
9+
10+
private def testExpr()(using Quotes): Expr[Unit] = {
11+
'{ Foo() } match
12+
case '{ Foo() } =>
13+
'{}
14+
}

tests/pos-macros/i15676/Test_2.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def Test() = foo.test()

0 commit comments

Comments
 (0)