Skip to content

Commit 372930e

Browse files
Merge pull request #13157 from dotty-staging/fix-#13095
Handle isDefinedInCurrentRun on no symbol
2 parents 91d11ab + 268b43c commit 372930e

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2455,7 +2455,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
24552455
}
24562456

24572457
def isDefinedInCurrentRun: Boolean =
2458-
self.topLevelClass.asClass.isDefinedInCurrentRun
2458+
self.exists && self.topLevelClass.asClass.isDefinedInCurrentRun
24592459
def isLocalDummy: Boolean = self.denot.isLocalDummy
24602460
def isRefinementClass: Boolean = self.denot.isRefinementClass
24612461
def isAliasType: Boolean = self.denot.isAliasType

tests/pos-macros/i13095/Macro_1.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
import scala.quoted.*
3+
4+
inline def testMacro = ${ test }
5+
6+
def test(using Quotes): Expr[Unit] =
7+
import quotes.reflect.*
8+
assert(!Symbol.noSymbol.isDefinedInCurrentRun)
9+
'{}

tests/pos-macros/i13095/Test_2.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def unitTest = testMacro

0 commit comments

Comments
 (0)