Skip to content

Commit

Permalink
experiment: do not bring forward symbols defined in transform and bac…
Browse files Browse the repository at this point in the history
…kend phases
  • Loading branch information
jchyb committed Oct 31, 2024
1 parent ad09ab8 commit 0e50d0c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/core/Denotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ object Denotations {
}
if (!symbol.exists) return updateValidity()
if (!coveredInterval.containsPhaseId(ctx.phaseId)) return NoDenotation
if (coveredInterval.firstPhaseId >= Phases.firstTransformPhase.id) return NoDenotation
// Moved to a companion class, likely at a later phase (in MoveStatics)
this match {
case symd: SymDenotation if movedToCompanionClass(symd) => return NoDenotation
Expand Down
6 changes: 6 additions & 0 deletions tests/pos-macros/i21844/Macro.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import scala.quoted.*

object Macro:
inline def foo = ${ fooImpl }
def fooImpl(using Quotes): Expr[Int] =
'{ 123 }
3 changes: 3 additions & 0 deletions tests/pos-macros/i21844/SubClass.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class SubClass extends SuperClass
object SubClass:
val foo: Int = Macro.foo
2 changes: 2 additions & 0 deletions tests/pos-macros/i21844/SuperClassWithLazyVal.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class SuperClass:
lazy val xyz: Int = 123

0 comments on commit 0e50d0c

Please sign in to comment.