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 {
245245 l == level ||
246246 sym.is(Inline ) && sym.owner.is(Macro ) && sym.info.isValueType && l - 1 == level
247247 case None =>
248- true
248+ level == 0
249249 }
250250
251251 /** 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 {
289289 if (! isThis) sym.show
290290 else if (sym.is(ModuleClass )) sym.sourceModule.show
291291 else i " ${sym.name}.this "
292- if (! isThis && sym.maybeOwner.isType)
292+ if (! isThis && sym.maybeOwner.isType && ! sym.is( Param ) )
293293 check(sym.owner, sym.owner.thisType, pos)
294294 else if (sym.exists && ! sym.isStaticOwner && ! levelOK(sym))
295295 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