File tree Expand file tree Collapse file tree 4 files changed +25
-2
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -144,6 +144,9 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
144
144
/** We are in a `~(...)` context that is not shadowed by a nested `'(...)` */
145
145
def inSplice = outer != null && ! inQuote
146
146
147
+ /** We are not in a `~(...)` or a `'(...)` */
148
+ def isRoot = outer != null
149
+
147
150
/** A map from type ref T to expressions of type `quoted.Type[T]`".
148
151
* These will be turned into splices using `addTags` and represent type variables
149
152
* that can be possibly healed.
@@ -242,8 +245,8 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
242
245
*/
243
246
def levelOK (sym : Symbol )(implicit ctx : Context ): Boolean = levelOf.get(sym) match {
244
247
case Some (l) =>
245
- l == level ||
246
- sym.is(Inline ) && sym.owner.is(Macro ) && sym.info.isValueType && l - 1 == level
248
+ if (level == 1 && l == level && sym.isType && sym.owner.is( Macro ) && outer.isRoot) false
249
+ else l == level || (l - 1 == level && sym.is(Inline ) && sym.owner.is(Macro ) && sym.info.isValueType)
247
250
case None =>
248
251
! sym.is(Param ) || levelOK(sym.owner)
249
252
}
Original file line number Diff line number Diff line change
1
+ class Index [K ]
2
+ object Index {
3
+ inline def succ [K ]: Unit = ~ {
4
+ '(new Index[K]) // error: missing typetag Type[K]. May not be an error if we synthesize them #4515.
5
+ }
6
+ }
Original file line number Diff line number Diff line change
1
+ class Index [K ]
2
+ object Index {
3
+ inline def succ [K ](x : K ): Unit = ~ {
4
+ implicit val t : quoted.Type [K ] = ' [K ]
5
+ '(new Index[K])
6
+ }
7
+ }
Original file line number Diff line number Diff line change
1
+ class Index [K ]
2
+ object Index {
3
+ inline def succ [K ]: Unit = ~ {
4
+ implicit val t : quoted.Type [K ] = ' [K ]
5
+ '(new Index[K])
6
+ }
7
+ }
You can’t perform that action at this time.
0 commit comments