Skip to content

Commit

Permalink
Test RedundantBraces in lambda with a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Sep 20, 2024
1 parent 2d13bda commit b3e0e45
Showing 1 changed file with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,60 @@ object a {
object a {
childContext.onDone { type a = Int }
}
<<< #4133 lambda body with a comment
rewrite.redundantBraces.maxLines = 100
===
object a {
lowClass.isJavaDefined && highClass.isJavaDefined && { // skip if both are java-defined, and
lowClass.isNonBottomSubClass(highClass) || { // - low <:< high, which means they are overrides in Java and javac is doing the check; or
base.info.parents.tail.forall(p => { // - every mixin parent is unrelated to (not a subclass of) low and high, i.e.,
val psym = p.typeSymbol // we're not mixing in high or low, both are coming from the superclass
!psym.isNonBottomSubClass(lowClass) && !psym.isNonBottomSubClass(highClass)
})
}
}
}
>>>
Idempotency violated
=> Diff (- obtained, + expected)
base.info.parents.tail
- .forall {
- p => // - every mixin parent is unrelated to (not a subclass of) low and high, i.e.,
- val psym =
- p.typeSymbol // we're not mixing in high or low, both are coming from the superclass
- !psym.isNonBottomSubClass(lowClass) && !psym.isNonBottomSubClass(
- highClass
- )
+ .forall { p => // - every mixin parent is unrelated to (not a subclass of) low and high, i.e.,
+ val psym =
+ p.typeSymbol // we're not mixing in high or low, both are coming from the superclass
+ !psym.isNonBottomSubClass(lowClass) && !psym.isNonBottomSubClass(
+ highClass
+ )
}
<<< #4133 lambda body without a comment
rewrite.redundantBraces.maxLines = 100
===
object a {
lowClass.isJavaDefined && highClass.isJavaDefined && {
lowClass.isNonBottomSubClass(highClass) || {
base.info.parents.tail.forall(p => {
val psym = p.typeSymbol
!psym.isNonBottomSubClass(lowClass) && !psym.isNonBottomSubClass(highClass)
})
}
}
}
>>>
object a {
lowClass.isJavaDefined && highClass.isJavaDefined && {
lowClass.isNonBottomSubClass(highClass) || {
base.info.parents.tail.forall { p =>
val psym = p.typeSymbol
!psym.isNonBottomSubClass(lowClass) && !psym.isNonBottomSubClass(
highClass
)
}
}
}
}

0 comments on commit b3e0e45

Please sign in to comment.