File tree 3 files changed +16
-2
lines changed
compiler/src/dotty/tools/dotc/ast 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import Trees._
5
5
import core .Contexts ._
6
6
import core .ContextOps .enter
7
7
import core .Flags ._
8
+ import core .NameOps ._
8
9
import core .Symbols ._
9
10
import core .TypeError
10
11
@@ -69,8 +70,17 @@ class TreeMapWithImplicits extends tpd.TreeMap {
69
70
importScopeCtx(stats)(using nestedCtx)
70
71
}
71
72
72
- private def nestedPackageScopeCtx (tree : PackageDef )(using Context ): Context =
73
- importScopeCtx(tree.stats)(using ctx.withOwner(tree.symbol))
73
+ private def nestedPackageScopeCtx (tree : PackageDef )(using Context ): Context = {
74
+ val nestedCtx = ctx.withOwner(tree.symbol).fresh.setNewScope
75
+ for
76
+ packageDecl <- tree.symbol.moduleClass.asClass.info.decls.toList
77
+ if packageDecl.isTerm && packageDecl.name.isPackageObjectName
78
+ decl <- packageDecl.info.decls.toList
79
+ if decl.isTerm && decl.isOneOf(GivenOrImplicit )
80
+ do
81
+ nestedCtx.enter(decl)
82
+ importScopeCtx(tree.stats)(using nestedCtx)
83
+ }
74
84
75
85
private def importScopeCtx (stats : List [Tree ])(using Context ): Context =
76
86
stats.foldLeft(ctx) {
Original file line number Diff line number Diff line change
1
+ trait Foo
2
+ given Foo : Foo with {}
3
+ inline def summonFoo (): Foo = scala.compiletime.summonInline[Foo ]
Original file line number Diff line number Diff line change
1
+ def test : Unit = summonFoo()
You can’t perform that action at this time.
0 commit comments