Skip to content

Commit ccc3896

Browse files
committed
GROOVY-9966
1 parent 783164f commit ccc3896

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

base-test/org.eclipse.jdt.groovy.core.tests.compiler/src/org/eclipse/jdt/groovy/core/tests/basic/GroovySimpleTests.java

+15
Original file line numberDiff line numberDiff line change
@@ -4655,6 +4655,21 @@ public void testGroovy9906() {
46554655
runConformTest(sources, "");
46564656
}
46574657

4658+
@Test // https://issues.apache.org/jira/browse/GROOVY-9966
4659+
public void testGroovy9966() {
4660+
//@formatter:off
4661+
String[] sources = {
4662+
"Main.groovy",
4663+
"import static java.util.Arrays.*\n" +
4664+
"def m(x) { return x }\n" +
4665+
"final value = 123.456\n" +
4666+
"m(\"$value\").missing\n",
4667+
};
4668+
//@formatter:on
4669+
4670+
runConformTest(sources, "", "groovy.lang.MissingPropertyException: No such property: missing for class: org.codehaus.groovy.runtime.GStringImpl");
4671+
}
4672+
46584673
// was worried <clinit> would surface in list of methods used to build the type declaration, but that doesn't appear to be the case
46594674
@Test
46604675
public void testExtendingGroovyObjects_clinit() {

base/org.codehaus.groovy30/src/org/codehaus/groovy/control/StaticImportVisitor.java

+6
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,19 @@ public Expression transform(Expression exp) {
132132
}
133133
if (clazz == ArgumentListExpression.class) {
134134
Expression result = exp.transformExpression(this);
135+
// GRECLIPSE add -- GROOVY-9966
136+
if (foundArgs == null)
137+
// GRECLIPSE end
135138
if (inPropertyExpression) {
136139
foundArgs = result;
137140
}
138141
return result;
139142
}
140143
if (exp instanceof ConstantExpression) {
141144
Expression result = exp.transformExpression(this);
145+
// GRECLIPSE add -- GROOVY-9966
146+
if (foundConstant == null)
147+
// GRECLIPSE end
142148
if (inPropertyExpression) {
143149
foundConstant = result;
144150
}

base/org.codehaus.groovy40/src/org/codehaus/groovy/control/StaticImportVisitor.java

+6
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,19 @@ public Expression transform(Expression exp) {
135135
}
136136
if (clazz == ArgumentListExpression.class) {
137137
Expression result = exp.transformExpression(this);
138+
// GRECLIPSE add -- GROOVY-9966
139+
if (foundArgs == null)
140+
// GRECLIPSE end
138141
if (inPropertyExpression) {
139142
foundArgs = result;
140143
}
141144
return result;
142145
}
143146
if (exp instanceof ConstantExpression) {
144147
Expression result = exp.transformExpression(this);
148+
// GRECLIPSE add -- GROOVY-9966
149+
if (foundConstant == null)
150+
// GRECLIPSE end
145151
if (inPropertyExpression) {
146152
foundConstant = result;
147153
}

0 commit comments

Comments
 (0)