This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 6ab3fa8f7d Use the tap() method instead of with(), as tap() returns 
the object instead of returning the last expression of the closure like with 
with(). Without this change, variable p3 actually contained the int 1951
6ab3fa8f7d is described below

commit 6ab3fa8f7d25d73346dbafbd8787c3a64a4f7a67
Author: Guillaume Laforge <glafo...@gmail.com>
AuthorDate: Wed Sep 13 10:36:54 2023 +0200

    Use the tap() method instead of with(), as tap() returns the object instead 
of returning the last expression of the closure like with with().
    Without this change, variable p3 actually contained the int 1951
---
 src/spec/test/CodeGenerationASTTransformsTest.groovy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spec/test/CodeGenerationASTTransformsTest.groovy 
b/src/spec/test/CodeGenerationASTTransformsTest.groovy
index 0d1345027b..096ff94102 100644
--- a/src/spec/test/CodeGenerationASTTransformsTest.groovy
+++ b/src/spec/test/CodeGenerationASTTransformsTest.groovy
@@ -1313,7 +1313,7 @@ assert "$p1.first $p1.last" == 'Johnny Depp'
 // end::builder_simple_usage[]
 // tag::builder_simple_alternatives[]
 def p2 = new Person(first: 'Keira', last: 'Knightley', born: 1985)
-def p3 = new Person().with {
+def p3 = new Person().tap {
     first = 'Geoffrey'
     last = 'Rush'
     born = 1951

Reply via email to