From notifications-return-12424-archive-asf-public=cust-asf.ponee.io@groovy.apache.org Wed May 23 01:27:04 2018 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 [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id C0A82180638 for ; Wed, 23 May 2018 01:27:03 +0200 (CEST) Received: (qmail 89169 invoked by uid 500); 22 May 2018 23:27:02 -0000 Mailing-List: contact notifications-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 notifications@groovy.apache.org Received: (qmail 89160 invoked by uid 99); 22 May 2018 23:27:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 May 2018 23:27:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 7E6931A2A8D for ; Tue, 22 May 2018 23:27:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -102.311 X-Spam-Level: X-Spam-Status: No, score=-102.311 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id rZwks1HDXBVN for ; Tue, 22 May 2018 23:27:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 7E9835F41A for ; Tue, 22 May 2018 23:27:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id C8594E0C50 for ; Tue, 22 May 2018 23:27:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 3EE6F217F4 for ; Tue, 22 May 2018 23:27:00 +0000 (UTC) Date: Tue, 22 May 2018 23:27:00 +0000 (UTC) From: "Paul King (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GROOVY-7753) regression of return type from ternary operator MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/GROOVY-7753?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16485746#comment-16485746 ] Paul King commented on GROOVY-7753: ----------------------------------- Hi Daniel, can you link the new issue to this one. Thanks. > regression of return type from ternary operator > ----------------------------------------------- > > Key: GROOVY-7753 > URL: https://issues.apache.org/jira/browse/GROOVY-7753 > Project: Groovy > Issue Type: Bug > Components: Static compilation, Static Type Checker > Affects Versions: 2.4.6 > Reporter: Jason Winnebeck > Assignee: Daniel Sun > Priority: Major > Fix For: 2.6.0-alpha-4, 3.0.0-alpha-3, 2.5.0-rc-3 > > > In Groovy 2.4.5 the following code works, but in Groovy 2.4.6, it fails to compile: > {code} > @groovy.transform.Field > String x = "X" > @groovy.transform.CompileStatic > public List getStrings() { > x ? [x] : Collections.emptyList() > } > getStrings() > {code} > In Groovy 2.4.6 the compile error is: > {code} > [Static type checking] - Incompatible generic argument types. Cannot assign java.util.List to: java.util.List > @ line 6, column 2. > x ? [x] : Collections.emptyList() > ^ > {code} > Workaround is to cast the result of emptyList to the erased type, (List) in this case. -- This message was sent by Atlassian JIRA (v7.6.3#76005)