File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
library/src/scala/tasty/reflect Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -891,6 +891,13 @@ trait Printers
891891 this += " = "
892892 printTree(rhs)
893893
894+ case Lambda (params, body) => // must come before `Block`
895+ inParens {
896+ printArgsDefs(params)
897+ this += " => "
898+ printTree(body)
899+ }
900+
894901 case Block (stats0, expr) =>
895902 val stats = stats0.filter {
896903 case IsValDef (tree) => ! tree.symbol.flags.is(Flags .Object )
@@ -901,14 +908,6 @@ trait Printers
901908 case Inlined (_, bindings, expansion) =>
902909 printFlatBlock(bindings, expansion)
903910
904- case Lambda (params, body) =>
905- inParens {
906- printArgsDefs(params)
907- this += " => "
908- printTree(body)
909- }
910-
911-
912911 case If (cond, thenp, elsep) =>
913912 this += highlightKeyword(" if " )
914913 inParens(printTree(cond))
Original file line number Diff line number Diff line change @@ -582,6 +582,9 @@ trait TreeOps extends Core {
582582 * closure(m)
583583 * }
584584 *
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`.
585588 */
586589 object Lambda {
587590 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