[ 
https://issues.apache.org/jira/browse/GROOVY-12722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18140683#comment-18140683
 ] 

ASF GitHub Bot commented on GROOVY-12722:
-----------------------------------------

testlens-app[bot] commented on PR #3256:
URL: https://github.com/apache/groovy/pull/3256#issuecomment-6720339086

   ## 🚨 All tests passed but jobs failed 🚨
   
   ### Failed Jobs without Test Failures
   
   ❌ [Build and test / lts \(21, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/42470857875/job/128701026392?pr=3256)
   ❌ [Build and test for coverage / 
test](https://github.com/apache/groovy/actions/runs/42470857636/job/128701024891?pr=3256)
   ❌ [Check licenses / test 
\(ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/42470857757/job/128701025455?pr=3256)
   ❌ [CodeQL / Analyze \(java, 
21\)](https://github.com/apache/groovy/actions/runs/42470857660/job/128701025145?pr=3256)
   ❌ [Generate SNAPSHOT distributions / 
dist](https://github.com/apache/groovy/actions/runs/42470857715/job/128701025251?pr=3256)
   ❌ [Native Image Metadata Check / 
native-check](https://github.com/apache/groovy/actions/runs/42470857642/job/128701025226?pr=3256)
   ❌ [Performance check / 
test](https://github.com/apache/groovy/actions/runs/42470857531/job/128701024482?pr=3256)
   ❌ [jmh / test \(core-ag, 
\\\\.perf\\\\.[A-G]\)](https://github.com/apache/groovy/actions/runs/42470857573/job/128701024845?pr=3256)
   ❌ [jmh / test \(grails-ad, 
\\\\.perf\\\\.grails\\\\.[A-D]\)](https://github.com/apache/groovy/actions/runs/42470857573/job/128701024777?pr=3256)
   ❌ [jmh / test \(grails-ez, 
\\\\.perf\\\\.grails\\\\.[E-Z]\)](https://github.com/apache/groovy/actions/runs/42470857573/job/128701024593?pr=3256)
   ❌ [jmh-classic / test \(core-hz, 
\\\\.perf\\\\.[H-Z]\)](https://github.com/apache/groovy/actions/runs/42470857752/job/128701025934?pr=3256)
   
   🏷️ Commit: 01ac7e78d701856ad2ce16bce0175902a7ae58cf
   ▶️ Tests:  3744 executed
   🟡 Checks: 15/25 completed
   
   ### Rerun Controls
   
   Click the checkbox to trigger a rerun:
   
   🔲 **Rerun jobs**
   
   ---
   _Learn more about TestLens at 
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
   




> sumParallel: add the no-argument and transform forms of sum(); the combiner 
> form reads as inject
> ------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12722
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12722
>             Project: Groovy
>          Issue Type: Improvement
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {{Collection.sum()}} adds the elements, and {{sum(Closure)}} adds the 
> transformed elements. 
> {{ParallelCollectionExtensions.sumParallel(Collection<T>, 
> BinaryOperator<T>)}} is a reduction with a required two-argument combiner 
> (GPars' {{sumParallel()}} took no argument; the migration guide maps it to 
> the two-parameter closure form, sumParallel { a, b -> a + b }, and notes that 
> the accumulator is required). Code written by analogy with {{sum}} fails:
> {code:groovy}
> @CompileStatic
> int total(List<Integer> numbers) {
>     numbers.sumParallel { Integer n -> n }
> }
> {code}
> {noformat}
> [Static type checking] - Wrong number of parameters for method target: 
> apply(java.lang.Integer, java.lang.Integer)
> {noformat}
> and in dynamic code items.sumParallel { it.price } calls the one-parameter 
> closure with two arguments.
> Proposal, additive:
> * {{sumParallel(Collection<?> self)}}: the elements added with the left 
> operand's {{plus}}, as {{sum()}} does; an empty collection gives null.
> * {{<T, R> R sumParallel(Collection<T> self, Closure<R> closure)}} with 
> {{@ClosureParams(value = FromString, options = ["T", "T,T"])}}: a 
> one-parameter closure is a transform and the transformed elements are added, 
> the {{sum(Closure)}} contract; a two-parameter closure stays the combiner, so 
> existing calls keep working and, under static compilation, keep their result 
> type. The {{BinaryOperator}} overload stays for method references and Java 
> callers.
> * {{CombinerChecker}} (GROOVY-12013) leaves a one-parameter closure alone: it 
> is not a combiner.
> * core-parallel-collections.adoc and the GPars migration table show the three 
> forms.
> Found while scoring Groovy 6.0.0 code written by language models: with the 
> parallel-collections skill text in front of it, GPT-6 still wrote the 
> one-parameter form.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to