Skip to content

Commit d93e10c

Browse files
committed
Fix tests
1 parent a147fba commit d93e10c

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

library/src/scala/tasty/reflect/Printers.scala

+1
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@ trait Printers
10331033
def printSeparator(next: Tree): Unit = {
10341034
// Avoid accidental application of opening `{` on next line with a double break
10351035
def rec(next: Tree): Unit = next match {
1036+
case Lambda(_, _) => this += lineBreak()
10361037
case Block(stats, _) if stats.nonEmpty => this += doubleLineBreak()
10371038
case Inlined(_, bindings, _) if bindings.nonEmpty => this += doubleLineBreak()
10381039
case Select(qual, _) => rec(qual)

tests/run-macros/i5941/macro_1.scala

+1-7
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,7 @@ object Lens {
4040

4141
object Function {
4242
def unapply(t: Term): Option[(List[ValDef], Term)] = t match {
43-
case Inlined(
44-
None, Nil,
45-
Block(
46-
(ddef @ DefDef(_, Nil, params :: Nil, _, Some(body))) :: Nil,
47-
Lambda(meth, _)
48-
)
49-
) if meth.symbol == ddef.symbol => Some((params, body))
43+
case Inlined(None, Nil, Lambda(params, body)) => Some((params, body))
5044
case _ => None
5145
}
5246
}

tests/run-macros/tasty-extractors-2.check

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Inlined(None, Nil, Block(List(ValDef("x", Inferred(), Some(Literal(Constant(1))))), Assign(Ident("x"), Literal(Constant(2)))))
22
Type.SymRef(IsClassDefSymbol(<scala.Unit>), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<scala>), NoPrefix())))
33

4-
Inlined(None, Nil, Block(List(DefDef("$anonfun", Nil, List(List(ValDef("x", TypeIdent("Int"), None))), Inferred(), Some(Ident("x")))), Lambda(Ident("$anonfun"), None)))
4+
Inlined(None, Nil, Block(List(DefDef("$anonfun", Nil, List(List(ValDef("x", TypeIdent("Int"), None))), Inferred(), Some(Ident("x")))), Closure(Ident("$anonfun"), None)))
55
Type.AppliedType(Type.SymRef(IsClassDefSymbol(<scala.Function1>), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<scala>), NoPrefix()))), List(Type.SymRef(IsClassDefSymbol(<scala.Int>), Type.SymRef(IsPackageDefSymbol(<scala>), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<<root>>), NoPrefix())))), Type.SymRef(IsClassDefSymbol(<scala.Int>), Type.SymRef(IsPackageDefSymbol(<scala>), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<<root>>), NoPrefix()))))))
66

77
Inlined(None, Nil, Ident("???"))
@@ -100,6 +100,6 @@ Type.SymRef(IsClassDefSymbol(<scala.Unit>), Type.ThisType(Type.SymRef(IsPackageD
100100
Inlined(None, Nil, Block(List(ClassDef("Foo", DefDef("<init>", Nil, List(Nil), Inferred(), None), List(Apply(Select(New(Inferred()), "<init>"), Nil)), Nil, None, List(TypeDef("X", TypeBoundsTree(Inferred(), Inferred())))), DefDef("f", Nil, List(List(ValDef("a", Refined(TypeIdent("Foo"), List(TypeDef("X", TypeIdent("Int")))), None))), TypeSelect(Ident("a"), "X"), Some(Ident("???")))), Literal(Constant(()))))
101101
Type.SymRef(IsClassDefSymbol(<scala.Unit>), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<scala>), NoPrefix())))
102102

103-
Inlined(None, Nil, Block(List(ValDef("lambda", Applied(Inferred(), List(TypeIdent("Int"), TypeIdent("Int"))), Some(Block(List(DefDef("$anonfun", Nil, List(List(ValDef("x", Inferred(), None))), Inferred(), Some(Ident("x")))), Lambda(Ident("$anonfun"), None))))), Literal(Constant(()))))
103+
Inlined(None, Nil, Block(List(ValDef("lambda", Applied(Inferred(), List(TypeIdent("Int"), TypeIdent("Int"))), Some(Block(List(DefDef("$anonfun", Nil, List(List(ValDef("x", Inferred(), None))), Inferred(), Some(Ident("x")))), Closure(Ident("$anonfun"), None))))), Literal(Constant(()))))
104104
Type.SymRef(IsClassDefSymbol(<scala.Unit>), Type.ThisType(Type.SymRef(IsPackageDefSymbol(<scala>), NoPrefix())))
105105

0 commit comments

Comments
 (0)