You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2024/05/13 04:35:00 UTC
[jira] [Updated] (GROOVY-11375) Power binary expression finds incorrect type - currently uses declaration inferred type
[ https://issues.apache.org/jira/browse/GROOVY-11375?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King updated GROOVY-11375:
-------------------------------
Summary: Power binary expression finds incorrect type - currently uses declaration inferred type (was: Power binary expression finds incorrect type)
> Power binary expression finds incorrect type - currently uses declaration inferred type
> ---------------------------------------------------------------------------------------
>
> Key: GROOVY-11375
> URL: https://issues.apache.org/jira/browse/GROOVY-11375
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
> Priority: Major
>
> For this code:
> {code}
> @groovy.transform.CompileStatic
> def method() {
> var temp = new Date()
> temp = temp.format('EEEE')[-3..-1].capitalize()
> assert temp == 'Day'
> temp = temp.size()
> assert temp ** temp == 27
> }
> method()
> {code}
> The compiler gives this error:
> {noformat}
> BUG! exception in phase 'class generation' in source unit 'ConsoleScript3' At line 10 column 8
> On receiver: temp with message: power and arguments: temp
> This method should not have been called. Please try to create a simple example reproducing
> this error and file a bug report at https://issues.apache.org/jira/browse/GROOVY
> at org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter.makeSingleArgumentCall(StaticTypesCallSiteWriter.java:582)
> at org.codehaus.groovy.classgen.asm.InvocationWriter.makeSingleArgumentCall(InvocationWriter.java:626)
> at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateBinaryExpression(BinaryExpressionHelper.java:602)
> at org.codehaus.groovy.classgen.asm.BinaryExpressionMultiTypeDispatcher.evaluateBinaryExpression(BinaryExpressionMultiTypeDispatcher.java:242)
> at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:264)
> at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:849)
> ...
> {noformat}
> We apply flow typing for the receiver but not the argument type. This looks like a case that should be handled where we currently have "TODO: more cases ..." in StaticTypesCallSiteWriter.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)