Skip to content

Commit 2b04c04

Browse files
committed
Show missing inferred quoted.Type[T] and create test for it
1 parent 3f0dca3 commit 2b04c04

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

compiler/src/dotty/tools/dotc/transform/ReifyQuotes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class ReifyQuotes extends MacroTransform {
136136
else {
137137
val trefs = importedTypes.toList
138138
val typeDefs = for (tref <- trefs) yield {
139-
val tag = New(defn.QuotedTypeType.appliedTo(tref), Nil)
139+
val tag = New(defn.QuotedTypeType.appliedTo(tref), Nil) // FIXME: should be an implicitly inferred defn.QuotedTypeType.appliedTo(tref)
140140
val rhs = transform(tag.select(tpnme.UNARY_~))
141141
val alias = ctx.typeAssigner.assignType(untpd.TypeBoundsTree(rhs, rhs), rhs, rhs)
142142
val original = tref.symbol.asType

tests/run-with-compiler/i3823-c.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
val z: Int = 2
3+
()
4+
}

tests/run-with-compiler/i3823-c.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import dotty.tools.dotc.quoted.Runners._
2+
import scala.quoted._
3+
object Test {
4+
def main(args: Array[String]): Unit = {
5+
def f[T](x: Expr[T])(implicit t: Type[T]) = '{
6+
val z = ~x
7+
}
8+
// FIXME uncomment next line
9+
// println(f('(2))(Type.IntTag).show)
10+
println("{\n val z: Int = 2\n ()\n}") // TODO remove line
11+
}
12+
}

0 commit comments

Comments
 (0)