diff --git a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic/GroovySimpleTests.java b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic/GroovySimpleTests.java index 87ace7901b..2d7ad5a590 100644 --- a/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic/GroovySimpleTests.java +++ b/base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic/GroovySimpleTests.java @@ -4655,6 +4655,21 @@ public void testGroovy9906() { runConformTest(sources, ""); } + @Test // https://issues.apache.org/jira/browse/GROOVY-9966 + public void testGroovy9966() { + //@formatter:off + String[] sources = { + "Main.groovy", + "import static java.util.Arrays.*\n" + + "def m(x) { return x }\n" + + "final value = 123.456\n" + + "m(\"$value\").missing\n", + }; + //@formatter:on + + runConformTest(sources, "", "groovy.lang.MissingPropertyException: No such property: missing for class: org.codehaus.groovy.runtime.GStringImpl"); + } + // was worried would surface in list of methods used to build the type declaration, but that doesn't appear to be the case @Test public void testExtendingGroovyObjects_clinit() { diff --git a/base/org.codehaus.groovy30/src/org/codehaus/groovy/control/StaticImportVisitor.java b/base/org.codehaus.groovy30/src/org/codehaus/groovy/control/StaticImportVisitor.java index 273eb5834d..7ecb72bc0e 100644 --- a/base/org.codehaus.groovy30/src/org/codehaus/groovy/control/StaticImportVisitor.java +++ b/base/org.codehaus.groovy30/src/org/codehaus/groovy/control/StaticImportVisitor.java @@ -132,6 +132,9 @@ public Expression transform(Expression exp) { } if (clazz == ArgumentListExpression.class) { Expression result = exp.transformExpression(this); + // GRECLIPSE add -- GROOVY-9966 + if (foundArgs == null) + // GRECLIPSE end if (inPropertyExpression) { foundArgs = result; } @@ -139,6 +142,9 @@ public Expression transform(Expression exp) { } if (exp instanceof ConstantExpression) { Expression result = exp.transformExpression(this); + // GRECLIPSE add -- GROOVY-9966 + if (foundConstant == null) + // GRECLIPSE end if (inPropertyExpression) { foundConstant = result; } diff --git a/base/org.codehaus.groovy40/src/org/codehaus/groovy/control/StaticImportVisitor.java b/base/org.codehaus.groovy40/src/org/codehaus/groovy/control/StaticImportVisitor.java index 34506beefd..1fe1a2b9b1 100644 --- a/base/org.codehaus.groovy40/src/org/codehaus/groovy/control/StaticImportVisitor.java +++ b/base/org.codehaus.groovy40/src/org/codehaus/groovy/control/StaticImportVisitor.java @@ -135,6 +135,9 @@ public Expression transform(Expression exp) { } if (clazz == ArgumentListExpression.class) { Expression result = exp.transformExpression(this); + // GRECLIPSE add -- GROOVY-9966 + if (foundArgs == null) + // GRECLIPSE end if (inPropertyExpression) { foundArgs = result; } @@ -142,6 +145,9 @@ public Expression transform(Expression exp) { } if (exp instanceof ConstantExpression) { Expression result = exp.transformExpression(this); + // GRECLIPSE add -- GROOVY-9966 + if (foundConstant == null) + // GRECLIPSE end if (inPropertyExpression) { foundConstant = result; }