Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/inlines/Inliner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,8 @@ class Inliner(val call: tpd.Tree)(using Context):
new TreeAccumulator[List[Symbol]] {
override def apply(syms: List[Symbol], tree: tpd.Tree)(using Context): List[Symbol] =
tree match {
case Closure(env, meth, tpt) if meth.symbol.isAnonymousFunction =>
this(syms, tpt :: env)
case tree: RefTree if tree.isTerm && level == -1 && tree.symbol.isDefinedInCurrentRun && !tree.symbol.isLocal =>
foldOver(tree.symbol :: syms, tree)
case _: This if level == -1 && tree.symbol.isDefinedInCurrentRun =>
Expand Down
22 changes: 22 additions & 0 deletions tests/pos-macros/i20353/Macro_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//> using options -experimental

import scala.annotation.{experimental, MacroAnnotation}
import scala.quoted.*

class ImplicitValue

object ImplicitValue:
inline given ImplicitValue =
${ makeImplicitValue }

def makeImplicitValue(using Quotes) =
import quotes.reflect.*
'{ ImplicitValue() }
end ImplicitValue

@experimental
class Test extends MacroAnnotation:
def transform(using Quotes)(definition: quotes.reflect.Definition, companion: Option[quotes.reflect.Definition]) =
import quotes.reflect.*
Implicits.search(TypeRepr.of[ImplicitValue])
List(definition)
17 changes: 17 additions & 0 deletions tests/pos-macros/i20353/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//> using options -experimental

class OuterClass:
@Test
class InnerClass

@Test
object InnerObject
end OuterClass

object OuterObject:
@Test
class InnerClass

@Test
object InnerObject
end OuterObject