File tree 4 files changed +16
-14
lines changed
compiler/src/scala/quoted/runtime/impl
4 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -528,14 +528,15 @@ object QuoteMatcher {
528
528
* * [x] cover the case of nested method call
529
529
* * [ ] contextual params?
530
530
* * [ ] erasure types?
531
- * * [ ] eta-expand only HOAS param methods
531
+ * * [x ] eta-expand only HOAS param methods
532
532
*/
533
533
case Apply (methId : Ident , args) =>
534
- val fnId = env.get(tree.symbol).flatMap(argsMap.get).getOrElse(tree)
535
- ctx.typer.typed(
536
- untpd.Apply (
537
- untpd.Select (untpd.TypedSplice (fnId), nme.apply),
538
- args.map(untpd.TypedSplice (_))))
534
+ env.get(tree.symbol).flatMap(argsMap.get)
535
+ .map(fnId => ctx.typer.typed(
536
+ untpd.Apply (
537
+ untpd.Select (untpd.TypedSplice (fnId), nme.apply),
538
+ args.map(untpd.TypedSplice (_)))))
539
+ .getOrElse(super .transform(tree))
539
540
case Apply (fun, args) =>
540
541
val tfun = transform(fun)
541
542
val targs = transform(args)
Original file line number Diff line number Diff line change 1
- case single: (1st case 1st) outside
2
- case curried: (2nd case 1st, 2nd) outside
1
+ case single: [1st case] arg1 outside
2
+ case curried: [2nd case] arg1, arg2 outside
3
+ case methods from outer scope: [1st case] arg1 outer-method
Original file line number Diff line number Diff line change @@ -4,9 +4,9 @@ inline def testExpr(inline body: Any) = ${ testExprImpl('body) }
4
4
def testExprImpl (body : Expr [Any ])(using Quotes ): Expr [String ] =
5
5
body match
6
6
case ' { def g (y : String ) = " placeholder" + y; $a(g): String } =>
7
- ' { $a((z : String ) => s " ( 1st case ${z}) " ) }
7
+ ' { $a((z : String ) => s " [ 1st case] ${z}" ) }
8
8
case ' { def g (y : String )(z : String ) = " placeholder" + y; $a(g): String } =>
9
- ' { $a((z1 : String ) => (z2 : String ) => s " ( 2nd case ${z1}, ${z2}) " ) }
9
+ ' { $a((z1 : String ) => (z2 : String ) => s " [ 2nd case] ${z1}, ${z2}" ) }
10
10
case _ => Expr (" not matched" )
11
11
12
12
// TODO issue-17105: Clean this up if not neccessary
Original file line number Diff line number Diff line change 1
1
@ main def Test : Unit =
2
- println(" case single: " + testExpr { def f (x : String ) = " placeholder" + x; f(" 1st " ) + " outside" })
3
- println(" case curried: " + testExpr { def f (x : String )(y : String ) = " placeholder" + x; f(" 1st " )(" 2nd " ) + " outside" })
4
- def outer () = " outside -method"
5
- println(" case methods from outer scope " + testExpr { def f (x : String ) = " placeholder" + x; f(" 1st " ) + outer() })
2
+ println(" case single: " + testExpr { def f (x : String ) = " placeholder" + x; f(" arg1 " ) + " outside" })
3
+ println(" case curried: " + testExpr { def f (x : String )(y : String ) = " placeholder" + x; f(" arg1 " )(" arg2 " ) + " outside" })
4
+ def outer () = " outer -method"
5
+ println(" case methods from outer scope: " + testExpr { def f (x : String ) = " placeholder" + x; f(" arg1 " ) + outer() })
You can’t perform that action at this time.
0 commit comments