File tree Expand file tree Collapse file tree 5 files changed +32
-2
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 5 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
245
245
l == level ||
246
246
sym.is(Inline ) && sym.owner.is(Macro ) && sym.info.isValueType && l - 1 == level
247
247
case None =>
248
- true
248
+ level == 0
249
249
}
250
250
251
251
/** Issue a "splice outside quote" error unless we ar in the body of an inline method */
@@ -289,7 +289,7 @@ class ReifyQuotes extends MacroTransformWithImplicits with InfoTransformer {
289
289
if (! isThis) sym.show
290
290
else if (sym.is(ModuleClass )) sym.sourceModule.show
291
291
else i " ${sym.name}.this "
292
- if (! isThis && sym.maybeOwner.isType)
292
+ if (! isThis && sym.maybeOwner.isType && ! sym.is( Param ) )
293
293
check(sym.owner, sym.owner.thisType, pos)
294
294
else if (sym.exists && ! sym.isStaticOwner && ! levelOK(sym))
295
295
for (errMsg <- tryHeal(tp, pos))
Original file line number Diff line number Diff line change
1
+ import scala .quoted .Type
2
+
3
+ class Foo [T ] {
4
+ '(null.asInstanceOf[T]) // error
5
+ }
Original file line number Diff line number Diff line change
1
+ import scala .quoted .Type
2
+
3
+ class Foo [T : Type ] {
4
+ '(null.asInstanceOf[T])
5
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ null.asInstanceOf[Object]
3
+ }
4
+ {
5
+ null.asInstanceOf[String]
6
+ }
Original file line number Diff line number Diff line change
1
+ import dotty .tools .dotc .quoted .Toolbox ._
2
+
3
+ import scala .quoted .Type
4
+
5
+ class Foo [T : Type ] {
6
+ def q = '(null.asInstanceOf[T])
7
+ }
8
+
9
+ object Test {
10
+ def main (args : Array [String ]): Unit = {
11
+ println((new Foo [Object ]).q.show)
12
+ println((new Foo [String ]).q.show)
13
+ }
14
+ }
You can’t perform that action at this time.
0 commit comments