File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -1948,7 +1948,7 @@ class Typer extends Namer
1948
1948
fun = ref(defn.QuotedMatcher_unapplyR ).appliedToType(patType),
1949
1949
implicits =
1950
1950
ref(defn.InternalQuoted_exprQuoteR ).appliedToType(shape.tpe).appliedTo(shape) ::
1951
- givenReflection :: Nil ,
1951
+ givenReflection(tree.span) :: Nil ,
1952
1952
patterns = splicePat :: Nil ,
1953
1953
proto = pt)
1954
1954
}
@@ -1979,7 +1979,8 @@ class Typer extends Namer
1979
1979
def patternHole (splice : Tree )(implicit ctx : Context ): Tree =
1980
1980
ref(defn.InternalQuoted_patternHoleR ).appliedToType(splice.tpe).withSpan(splice.span)
1981
1981
1982
- def givenReflection (implicit ctx : Context ): Tree = Literal (Constant (null )) // FIXME: fill in
1982
+ def givenReflection (span : Span )(implicit ctx : Context ): Tree =
1983
+ implicitArgTree(defn.TastyReflectionType , span)
1983
1984
1984
1985
/** Translate `${ t: Expr[T] }` into expression `t.splice` while tracking the quotation level in the context */
1985
1986
def typedSplice (tree : untpd.Splice , pt : Type )(implicit ctx : Context ): Tree = track(" typedSplice" ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ object Test {
5
5
def f (x : Int ) = x
6
6
def g (x : Int , y : Int ) = x * y
7
7
8
- x match {
8
+ def test given tasty . Reflection = x match {
9
9
case ' { val a = ' { println($y) }; 0 } => ??? // error: Not found: y
10
10
case _ =>
11
11
}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ object Test {
5
5
def f (x : Int ) = x
6
6
def g (x : Int , y : Int ) = x * y
7
7
8
- val res : quoted.Expr [Int ] = x match {
8
+ def res given tasty . Reflection : quoted.Expr [Int ] = x match {
9
9
case ' {1 + 2 } => ' {0 }
10
10
case ' {f($y)} => y
11
11
case ' {g($y, $z)} => ' {$y * $z}
You can’t perform that action at this time.
0 commit comments