You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/04/10 21:30:00 UTC
[jira] [Resolved] (GROOVY-11007) STC: instanceof guard for property loses type information
[ https://issues.apache.org/jira/browse/GROOVY-11007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles resolved GROOVY-11007.
----------------------------------
Resolution: Fixed
https://github.com/apache/groovy/commit/e7e057f4ba4a3bfa617d9770f8d364ab40b4108b
> STC: instanceof guard for property loses type information
> ---------------------------------------------------------
>
> Key: GROOVY-11007
> URL: https://issues.apache.org/jira/browse/GROOVY-11007
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 3.0.17, 4.0.11
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> Consider the following:
> {code:groovy}
> interface I {
> CharSequence getCharSequence()
> }
> void accept(CharSequence cs) { }
> void test(I i) {
> i.with {
> if (charSequence instanceof String) {
> charSequence.toUpperCase()
> accept(charSequence)
> }
> }
> }
> test({ -> 'works' } as I)
> {code}
> Reports "Cannot find matching method script#accept(java.lang.Object)".
--
This message was sent by Atlassian Jira
(v8.20.10#820010)