From c971608de41cdbcd755139f7d70249c99b85f257 Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Mon, 30 Sep 2024 09:05:53 -0700 Subject: [PATCH] Test applies/selects with a partial function --- .../resources/newlines/source_classic.stat | 27 ++++++++++++++++ .../test/resources/newlines/source_fold.stat | 26 +++++++++++++++ .../test/resources/newlines/source_keep.stat | 26 +++++++++++++++ .../resources/newlines/source_unfold.stat | 32 +++++++++++++++++++ 4 files changed, 111 insertions(+) diff --git a/scalafmt-tests/shared/src/test/resources/newlines/source_classic.stat b/scalafmt-tests/shared/src/test/resources/newlines/source_classic.stat index e6e1efbe63..21a83d53ac 100644 --- a/scalafmt-tests/shared/src/test/resources/newlines/source_classic.stat +++ b/scalafmt-tests/shared/src/test/resources/newlines/source_classic.stat @@ -9662,6 +9662,33 @@ object a { } } } +<<< #4133 applies and selects with a partial function 1 +maxColumn = 76 +runner.parser = source +=== +val fieldsCasts = from.fields.zip(to.fields).map { + case (fromField, toField) => nullSafeCastFunction(fromField.dataType, toField.dataType, ctx) +} +>>> +val fieldsCasts = + from.fields.zip(to.fields).map { case (fromField, toField) => + nullSafeCastFunction(fromField.dataType, toField.dataType, ctx) + } +<<< #4133 applies and selects with a partial function 2 +maxColumn = 76 +=== +val stats = Profiler.getStatistics().asScala.toSeq.map { + case (trace, count) => MethodCallTrace(trace.className, trace.methodName, trace.methodDescriptor) -> count.intValue +} +>>> +val stats = + Profiler.getStatistics().asScala.toSeq.map { case (trace, count) => + MethodCallTrace( + trace.className, + trace.methodName, + trace.methodDescriptor + ) -> count.intValue + } <<< #4133 partial function within apply, short rdd.map( {case (id, count) => (count, id)}) diff --git a/scalafmt-tests/shared/src/test/resources/newlines/source_fold.stat b/scalafmt-tests/shared/src/test/resources/newlines/source_fold.stat index cbec2545ac..a9c3bf5a45 100644 --- a/scalafmt-tests/shared/src/test/resources/newlines/source_fold.stat +++ b/scalafmt-tests/shared/src/test/resources/newlines/source_fold.stat @@ -9061,6 +9061,32 @@ object a { } } } +<<< #4133 applies and selects with a partial function 1 +maxColumn = 76 +runner.parser = source +=== +val fieldsCasts = from.fields.zip(to.fields).map { + case (fromField, toField) => nullSafeCastFunction(fromField.dataType, toField.dataType, ctx) +} +>>> +val fieldsCasts = from.fields.zip(to.fields) + .map { case (fromField, toField) => + nullSafeCastFunction(fromField.dataType, toField.dataType, ctx) + } +<<< #4133 applies and selects with a partial function 2 +maxColumn = 76 +=== +val stats = Profiler.getStatistics().asScala.toSeq.map { + case (trace, count) => MethodCallTrace(trace.className, trace.methodName, trace.methodDescriptor) -> count.intValue +} +>>> +val stats = Profiler.getStatistics().asScala.toSeq.map { + case (trace, count) => MethodCallTrace( + trace.className, + trace.methodName, + trace.methodDescriptor + ) -> count.intValue +} <<< #4133 partial function within apply, short rdd.map( {case (id, count) => (count, id)}) diff --git a/scalafmt-tests/shared/src/test/resources/newlines/source_keep.stat b/scalafmt-tests/shared/src/test/resources/newlines/source_keep.stat index eaabfbff81..798266b4cb 100644 --- a/scalafmt-tests/shared/src/test/resources/newlines/source_keep.stat +++ b/scalafmt-tests/shared/src/test/resources/newlines/source_keep.stat @@ -9459,6 +9459,32 @@ object a { } } } +<<< #4133 applies and selects with a partial function 1 +maxColumn = 76 +runner.parser = source +=== +val fieldsCasts = from.fields.zip(to.fields).map { + case (fromField, toField) => nullSafeCastFunction(fromField.dataType, toField.dataType, ctx) +} +>>> +val fieldsCasts = from.fields.zip(to.fields).map { + case (fromField, toField) => + nullSafeCastFunction(fromField.dataType, toField.dataType, ctx) +} +<<< #4133 applies and selects with a partial function 2 +maxColumn = 76 +=== +val stats = Profiler.getStatistics().asScala.toSeq.map { + case (trace, count) => MethodCallTrace(trace.className, trace.methodName, trace.methodDescriptor) -> count.intValue +} +>>> +val stats = Profiler.getStatistics().asScala.toSeq.map { + case (trace, count) => MethodCallTrace( + trace.className, + trace.methodName, + trace.methodDescriptor + ) -> count.intValue +} <<< #4133 partial function within apply, short rdd.map( {case (id, count) => (count, id)}) diff --git a/scalafmt-tests/shared/src/test/resources/newlines/source_unfold.stat b/scalafmt-tests/shared/src/test/resources/newlines/source_unfold.stat index 9d30b5cf52..9791a22937 100644 --- a/scalafmt-tests/shared/src/test/resources/newlines/source_unfold.stat +++ b/scalafmt-tests/shared/src/test/resources/newlines/source_unfold.stat @@ -9739,6 +9739,38 @@ object a { } } } +<<< #4133 applies and selects with a partial function 1 +maxColumn = 76 +runner.parser = source +=== +val fieldsCasts = from.fields.zip(to.fields).map { + case (fromField, toField) => nullSafeCastFunction(fromField.dataType, toField.dataType, ctx) +} +>>> +val fieldsCasts = from + .fields + .zip(to.fields) + .map { case (fromField, toField) => + nullSafeCastFunction(fromField.dataType, toField.dataType, ctx) + } +<<< #4133 applies and selects with a partial function 2 +maxColumn = 76 +=== +val stats = Profiler.getStatistics().asScala.toSeq.map { + case (trace, count) => MethodCallTrace(trace.className, trace.methodName, trace.methodDescriptor) -> count.intValue +} +>>> +val stats = Profiler + .getStatistics() + .asScala + .toSeq + .map { case (trace, count) => + MethodCallTrace( + trace.className, + trace.methodName, + trace.methodDescriptor + ) -> count.intValue + } <<< #4133 partial function within apply, short rdd.map( {case (id, count) => (count, id)})