eric-milles opened a new pull request, #2397: URL: https://github.com/apache/groovy/pull/2397
Changes to `StaticTypesTypeChooser` in Groovy 5 caused a cast exception at runtime for statically-compiled imbalanced-`instanceof` scenarios like `if (cn instanceof InnerClassNode || cn.isEnum())`. This traces back to the temp types storage in STC. For the statement above, only `InnerClassNode` is saved as a temp type. When the temp type is computed for "cn.isEnum()", `InnerClassNode` is the result. A small part of the GROOVY-7971 solution is to mix in the original variable type in a scenario such as this -- to express the optionality of instance check(s). I back-ported just this part of the larger solution. This stops the cast exception for the GROOVY-11754 scenario. This is a pre-condition for introducing the GROOVY-11769 `StaticTypesTypeChooser` change (see #2311) into Groovy 4. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
