[ https://issues.apache.org/jira/browse/GROOVY-8317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexey Afanasiev updated GROOVY-8317: ------------------------------------- Description: Should be compiled well: {code} @CompileStatic class TestType { static def bar(Object b) { b.with { obj -> assert obj instanceof String obj.toUpperCase() // error: Cannot find matching method java.lang.Object#toUpperCase(). } } } {code} Funny moment - on implicit 'it' parameter works fine: {code} @CompileStatic class TestType { static def bar(Object b) { b.with { assert it instanceof String it.toUpperCase() } } } {code} was: Should be compiled well: {code} @CompileStatic class TestType { static def bar(Object b) { b.with { obj -> assert obj instanceof String obj.toUpperCase() // error: Cannot find matching method java.lang.Object#toUpperCase(). } } } {code} Funny moment on implicit 'it' parameter works fine: {code} @CompileStatic class TestType { static def bar(Object b) { b.with { assert it instanceof String it.toUpperCase() } } } {code} > Smart type inference doesn't work on explicit closure params > ------------------------------------------------------------ > > Key: GROOVY-8317 > URL: https://issues.apache.org/jira/browse/GROOVY-8317 > Project: Groovy > Issue Type: Bug > Components: Static compilation, Static Type Checker > Reporter: Alexey Afanasiev > > Should be compiled well: > {code} > @CompileStatic > class TestType { > static def bar(Object b) { > b.with { obj -> > assert obj instanceof String > obj.toUpperCase() // error: Cannot find matching method > java.lang.Object#toUpperCase(). > } > } > } > {code} > Funny moment - on implicit 'it' parameter works fine: > {code} > @CompileStatic > class TestType { > static def bar(Object b) { > b.with { > assert it instanceof String > it.toUpperCase() > } > } > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)