You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@groovy.apache.org by "Daniel.Sun" <su...@apache.org> on 2018/09/08 00:12:23 UTC
About `char` type in STC
Hi all,
STC can not coerce string with single character to char when passing
parameters, e.g.
```
@groovy.transform.CompileStatic
class Test {
static s(char delimiter) {}
static void main(String[] args) {
char a = 'x' // works
s(',' as char) // works
s(',') // [Static type checking] - Cannot find matching method
Test#s(java.lang.String).
}
}
```
I wonder it is designed on purpose or a bug?
Cheers,
Daniel.Sun
-----
Daniel Sun
Apache Groovy committer
Blog: http://blog.sunlan.me
Twitter: @daniel_sun
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
Re: About `char` type in STC
Posted by "Daniel.Sun" <su...@apache.org>.
Hi Jochen,
It is in my TODO list too... Now I will remove the task.
If somebody could tell me the reason, it would be great...
Cheers,
Daniel.Sun
-----
Daniel Sun
Apache Groovy committer
Blog: http://blog.sunlan.me
Twitter: @daniel_sun
--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
Re: About `char` type in STC
Posted by Jochen Theodorou <bl...@gmx.org>.
On 08.09.2018 02:12, Daniel.Sun wrote:
> Hi all,
>
> STC can not coerce string with single character to char when passing
> parameters, e.g.
[...]
> I wonder it is designed on purpose or a bug?
I recall that being on purpose, sadly I do not recall why.
bye Jochen