[GitHub] groovy pull request #798: GROOVY-8549: Compile Static causes getAt to fail

2018-10-10 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/798


---


[GitHub] groovy pull request #798: GROOVY-8549: Compile Static causes getAt to fail

2018-09-16 Thread paulk-asert
GitHub user paulk-asert opened a pull request:

https://github.com/apache/groovy/pull/798

GROOVY-8549: Compile Static causes getAt to fail

I started fixing this in STCSW first with something like below but then 
putAt also needs fixing.
In the meantime, the added DGM methods provide sufficient info for the 
static compiler to behave correctly.

```
Index: 
src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===
--- 
src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
(revision ba5eb9b2f19ca0cc8927359ce414c4e1974b7016)
+++ 
src/main/java/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
(date 1537092045389)
@@ -663,6 +663,10 @@
 ClassNode classNode = controller.getClassNode();
 ClassNode rType = typeChooser.resolveType(receiver, classNode);
 ClassNode aType = typeChooser.resolveType(arguments, classNode);
+if ("getAt".equals(message) && 
(rType.implementsInterface(LIST_TYPE) || LIST_TYPE.equals(rType)) &&
+isOrExtends(aType, Number_TYPE))) {
+aType = int_TYPE;
+}
 if (trySubscript(receiver, message, arguments, rType, aType, 
safe)) {
 return;
 }

```

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/paulk-asert/groovy groovy8549

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/groovy/pull/798.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #798


commit e9d12703d6a29adf05694e3c04986ee5bbf96fd4
Author: Paul King 
Date:   2018-09-16T11:26:51Z

GROOVY-8549: Compile Static causes getAt to fail




---