File tree 3 files changed +13
-2
lines changed
compiler/src/dotty/tools/dotc
3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ class TreeMapWithImplicits extends tpd.TreeMap {
62
62
private def nestedScopeCtx (defs : List [Tree ])(implicit ctx : Context ): Context = {
63
63
val nestedCtx = ctx.fresh.setNewScope
64
64
defs foreach {
65
- case d : DefTree => nestedCtx.enter(d.symbol)
65
+ case d : DefTree if d.symbol.isOneOf( GivenOrImplicit ) => nestedCtx.enter(d.symbol)
66
66
case _ =>
67
67
}
68
68
nestedCtx
@@ -73,7 +73,7 @@ class TreeMapWithImplicits extends tpd.TreeMap {
73
73
new TreeTraverser {
74
74
def traverse (tree : Tree )(implicit ctx : Context ): Unit = {
75
75
tree match {
76
- case d : DefTree => nestedCtx.enter(d.symbol)
76
+ case d : DefTree if d.symbol.isOneOf( GivenOrImplicit ) => nestedCtx.enter(d.symbol)
77
77
case _ =>
78
78
}
79
79
traverseChildren(tree)
Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ class PCPCheckAndHeal(@constructorOnly ictx: Context) extends TreeMapWithStages(
38
38
transform(tree)(ctx.withSource(tree.source))
39
39
else tree match {
40
40
case tree : DefDef if tree.symbol.is(Inline ) && level > 0 => EmptyTree
41
+ case tree : DefTree =>
42
+ for (annot <- tree.symbol.annotations)
43
+ transform(annot.tree) given ctx .withOwner(tree.symbol)
44
+ checkLevel(super .transform(tree))
41
45
case _ => checkLevel(super .transform(tree))
42
46
}
43
47
}
Original file line number Diff line number Diff line change
1
+ import scala .quoted ._
2
+ class Test {
3
+ def foo (str : String ) given QuoteContext = ' {
4
+ @ deprecated(str, " " ) // error
5
+ def bar = ???
6
+ }
7
+ }
You can’t perform that action at this time.
0 commit comments