Skip to content

Commit

Permalink
TreeExtractors: use Type.Apply in Type.With chain
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Dec 23, 2021
1 parent f8b309f commit 8f8267e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ object WithChain {
// self types, params, val/def/var/type definitions or declarations
val top = TreeOps.topTypeWith(t)
top.parent match {
case Some(_: Defn | _: Decl | _: Term.Param | _: Self) => Some(top)
case Some(_: Defn | _: Decl | _: Term.Param | _: Self | _: Type.Apply) =>
Some(top)
case _ => None
}
}
Expand Down
19 changes: 16 additions & 3 deletions scalafmt-tests/src/test/resources/binPack/ParentConstructors.stat
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ DTDataset[
]
>>>
def method[T <: ColType](): DTDataset[
T with ACol with BCol with CCol with DCol with ECol with FCol with GCol with HCol with ICol
T with ACol with BCol with CCol
with DCol with ECol with FCol
with GCol with HCol with ICol
]
<<< #2977 binpack never
binPack.parentConstructors = never
Expand All @@ -87,7 +89,15 @@ DTDataset[
]
>>>
def method[T <: ColType](): DTDataset[
T with ACol with BCol with CCol with DCol with ECol with FCol with GCol with HCol with ICol
T with ACol
with BCol
with CCol
with DCol
with ECol
with FCol
with GCol
with HCol
with ICol
]
<<< #2977 binpack keep
binPack.parentConstructors = keep
Expand All @@ -99,5 +109,8 @@ DTDataset[
]
>>>
def method[T <: ColType](): DTDataset[
T with ACol with BCol with CCol with DCol with ECol with FCol with GCol with HCol with ICol
T with ACol with BCol with CCol
with DCol with ECol
with FCol with GCol with HCol
with ICol
]
4 changes: 2 additions & 2 deletions scalafmt-tests/src/test/resources/default/TypeWith.stat
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
>>>
{
def getAnnotationOwner(
annotationOwnerLookUp: ScLiteral => Option[
PsiAnnotationOwner with PsiElement]): Option[PsiAnnotationOwner] = 1
annotationOwnerLookUp: ScLiteral => Option[PsiAnnotationOwner
with PsiElement]): Option[PsiAnnotationOwner] = 1
}
<<< #1133
indent.main = 4
Expand Down

0 comments on commit 8f8267e

Please sign in to comment.