From commits-return-9580-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Sat Nov 2 14:38:42 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id A874D180661 for ; Sat, 2 Nov 2019 15:38:42 +0100 (CET) Received: (qmail 18958 invoked by uid 500); 2 Nov 2019 14:38:42 -0000 Mailing-List: contact commits-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list commits@groovy.apache.org Received: (qmail 18945 invoked by uid 99); 2 Nov 2019 14:38:42 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Nov 2019 14:38:42 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id E561A805E6; Sat, 2 Nov 2019 14:38:41 +0000 (UTC) Date: Sat, 02 Nov 2019 14:38:41 +0000 To: "commits@groovy.apache.org" Subject: [groovy] branch master updated: Add a test for `with` under STC mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <157270552178.24537.18415776473433698359@gitbox.apache.org> From: sunlan@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: groovy X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 20b83b8c22bbb6b929dfa37706de583489ecf4de X-Git-Newrev: 6a38f524ecbba56673521613557da2e647a6c9c3 X-Git-Rev: 6a38f524ecbba56673521613557da2e647a6c9c3 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. sunlan 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 6a38f52 Add a test for `with` under STC mode 6a38f52 is described below commit 6a38f524ecbba56673521613557da2e647a6c9c3 Author: Daniel Sun AuthorDate: Sat Nov 2 22:38:29 2019 +0800 Add a test for `with` under STC mode --- src/test/groovy/transform/stc/WithSTCTest.groovy | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/test/groovy/transform/stc/WithSTCTest.groovy b/src/test/groovy/transform/stc/WithSTCTest.groovy index afae05c..083346a 100644 --- a/src/test/groovy/transform/stc/WithSTCTest.groovy +++ b/src/test/groovy/transform/stc/WithSTCTest.groovy @@ -48,5 +48,18 @@ class WithSTCTest extends StaticTypeCheckingTestCase { assert Test.a( 'TIM' ) == 'tim' ''' } -} + void testIntReturnType() { + assertScript ''' + class Test { + static int a(String s) { + s.toCharArray().with { + length + } + } + } + + assert Test.a( 'Daniel' ) == 6 + ''' + } +}