File tree 2 files changed +10
-8
lines changed
library/src/scala/tasty/reflect
2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -891,6 +891,13 @@ trait Printers
891
891
this += " = "
892
892
printTree(rhs)
893
893
894
+ case Lambda (params, body) => // must come before `Block`
895
+ inParens {
896
+ printArgsDefs(params)
897
+ this += " => "
898
+ printTree(body)
899
+ }
900
+
894
901
case Block (stats0, expr) =>
895
902
val stats = stats0.filter {
896
903
case IsValDef (tree) => ! tree.symbol.flags.is(Flags .Object )
@@ -901,14 +908,6 @@ trait Printers
901
908
case Inlined (_, bindings, expansion) =>
902
909
printFlatBlock(bindings, expansion)
903
910
904
- case Lambda (params, body) =>
905
- inParens {
906
- printArgsDefs(params)
907
- this += " => "
908
- printTree(body)
909
- }
910
-
911
-
912
911
case If (cond, thenp, elsep) =>
913
912
this += highlightKeyword(" if " )
914
913
inParens(printTree(cond))
Original file line number Diff line number Diff line change @@ -582,6 +582,9 @@ trait TreeOps extends Core {
582
582
* closure(m)
583
583
* }
584
584
*
585
+ * @note Due to the encoding, in pattern matches the case for `Lambda`
586
+ * should come before the case for `Block` to avoid mishandling
587
+ * of `Lambda`.
585
588
*/
586
589
object Lambda {
587
590
def unapply (tree : Tree )(implicit ctx : Context ): Option [(List [ValDef ], Term )] = tree match {
You can’t perform that action at this time.
0 commit comments