Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TreeOps: classify Type.Apply only as isCallSite #2749

Merged
merged 1 commit into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ class Router(formatOps: FormatOps) {
val defnSite = !tupleSite && anyDefnSite

val indent =
if (anyDefnSite && !leftOwner.isInstanceOf[Type.Apply])
tgodzik marked this conversation as resolved.
Show resolved Hide resolved
if (anyDefnSite)
Num(style.indent.getDefnSite(leftOwner))
else
Num(style.indent.callSite)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,9 @@ object TreeOps {
tree match {
case _: Decl.Def | _: Defn.Def | _: Defn.Macro | _: Defn.Class |
_: Defn.Trait | _: Ctor.Secondary | _: Decl.Type | _: Defn.Type |
_: Type.Apply | _: Type.Param | _: Type.Tuple | _: Defn.Enum |
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

take a look at line 440 below. Type.Apply is present in both call site and defn site, but it can't be both.

_: Defn.EnumCase | _: Defn.ExtensionGroup | _: Decl.Given |
_: Defn.Given | _: Defn.GivenAlias =>
_: Type.Param | _: Type.Tuple | _: Defn.Enum | _: Defn.EnumCase |
_: Defn.ExtensionGroup | _: Decl.Given | _: Defn.Given |
_: Defn.GivenAlias =>
true
case _: Term.FunctionTerm | _: Type.FunctionType => true
case _: Term.PolyFunction | _: Type.PolyFunction => true
Expand Down
4 changes: 2 additions & 2 deletions scalafmt-tests/src/test/resources/scalajs/Class.stat
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class Promise[+A](
executor: js.Function2[js.Function1[A | Thenable[A], _], js.Function1[scala.Any, _], _])
>>>
class Promise[+A](
executor: js.Function2[
js.Function1[A | Thenable[A], _], js.Function1[scala.Any, _], _])
executor: js.Function2[js.Function1[A | Thenable[A], _], js.Function1[
scala.Any, _], _])
<<< #270
object a {
private class Encoder extends CharsetEncoder(
Expand Down
2 changes: 1 addition & 1 deletion scalafmt-tests/src/test/resources/scalajs/DefDef.stat
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ implicit def toFunction22[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,
js.Array[JSStackTraceElem], js.Array[JSStackTraceElem]]] = js.native
>>>
def sourceMapper: js.UndefOr[js.Function1[ // scalastyle:ignore
js.Array[JSStackTraceElem], js.Array[JSStackTraceElem]]] = js.native
js.Array[JSStackTraceElem], js.Array[JSStackTraceElem]]] = js.native
<<< comment inside middle of type parameter #264 3
def sourceMapper: js.UndefOr[ // scalastyle:ignore
js.Array[JSStackTraceElem], js.Array[JSStackTraceElem]] = js.native
Expand Down