Skip to content

Commit

Permalink
GROOVY-8965, GROOVY-10180, GROOVY-10668
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Jul 7, 2022
1 parent 1ff1120 commit 5d64fb8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4470,12 +4470,16 @@ protected List<Receiver<String>> makeOwnerList(final Expression objectExpression
List<Receiver<String>> owners = new ArrayList<>();
if (typeCheckingContext.delegationMetadata != null
&& objectExpression instanceof VariableExpression
&& ((VariableExpression) objectExpression).getName().equals("owner")
&& ((Variable) objectExpression).getName().equals("owner")
&& /*isNested:*/typeCheckingContext.delegationMetadata.getParent() != null) {
List<Receiver<String>> enclosingClass = Collections.singletonList(
Receiver.<String>make(typeCheckingContext.getEnclosingClassNode()));
addReceivers(owners, enclosingClass, typeCheckingContext.delegationMetadata.getParent(), "owner.");
} else {
// GRECLIPSE add -- GROOVY-8965, GROOVY-10180, GROOVY-10668
List<ClassNode> temporaryTypes = getTemporaryTypesForExpression(objectExpression);
if (asBoolean(temporaryTypes)) owners.add(Receiver.make(lowestUpperBound(temporaryTypes)));
// GRECLIPSE end
if (isClassClassNodeWrappingConcreteType(receiver)) {
ClassNode staticType = receiver.getGenericsTypes()[0].getType();
owners.add(Receiver.<String>make(staticType)); // Type from Class<Type>
Expand All @@ -4489,6 +4493,7 @@ protected List<Receiver<String>> makeOwnerList(final Expression objectExpression
owners.add(Receiver.<String>make(OBJECT_TYPE));
}
}
/* GRECLIPSE edit
if (!typeCheckingContext.temporaryIfBranchTypeInformation.isEmpty()) {
List<ClassNode> potentialReceiverType = getTemporaryTypesForExpression(objectExpression);
if (potentialReceiverType != null && !potentialReceiverType.isEmpty()) {
Expand All @@ -4497,9 +4502,10 @@ protected List<Receiver<String>> makeOwnerList(final Expression objectExpression
}
}
}
*/
if (typeCheckingContext.lastImplicitItType != null
&& objectExpression instanceof VariableExpression
&& ((VariableExpression) objectExpression).getName().equals("it")) {
&& ((Variable) objectExpression).getName().equals("it")) {
owners.add(Receiver.<String>make(typeCheckingContext.lastImplicitItType));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4185,12 +4185,16 @@ protected List<Receiver<String>> makeOwnerList(final Expression objectExpression
List<Receiver<String>> owners = new ArrayList<>();
if (typeCheckingContext.delegationMetadata != null
&& objectExpression instanceof VariableExpression
&& ((VariableExpression) objectExpression).getName().equals("owner")
&& ((Variable) objectExpression).getName().equals("owner")
&& /*isNested:*/typeCheckingContext.delegationMetadata.getParent() != null) {
List<Receiver<String>> enclosingClass = Collections.singletonList(
Receiver.make(typeCheckingContext.getEnclosingClassNode()));
addReceivers(owners, enclosingClass, typeCheckingContext.delegationMetadata.getParent(), "owner.");
} else {
// GRECLIPSE add -- GROOVY-8965, GROOVY-10180, GROOVY-10668
List<ClassNode> temporaryTypes = getTemporaryTypesForExpression(objectExpression);
if (asBoolean(temporaryTypes)) owners.add(Receiver.make(lowestUpperBound(temporaryTypes)));
// GRECLIPSE end
if (isClassClassNodeWrappingConcreteType(receiver)) {
ClassNode staticType = receiver.getGenericsTypes()[0].getType();
owners.add(Receiver.make(staticType)); // Type from Class<Type>
Expand All @@ -4209,6 +4213,7 @@ protected List<Receiver<String>> makeOwnerList(final Expression objectExpression
&& ((Variable) objectExpression).getName().equals("it")) {
owners.add(Receiver.make(typeCheckingContext.lastImplicitItType));
}
/* GRECLIPSE edit
if (!typeCheckingContext.temporaryIfBranchTypeInformation.isEmpty()) {
List<ClassNode> instanceofTypes = getTemporaryTypesForExpression(objectExpression);
if (instanceofTypes != null && !instanceofTypes.isEmpty()) {
Expand All @@ -4217,6 +4222,7 @@ protected List<Receiver<String>> makeOwnerList(final Expression objectExpression
owners.add(Receiver.make(instanceofType));
}
}
*/
}
return owners;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3804,12 +3804,13 @@ protected List<Receiver<String>> makeOwnerList(final Expression objectExpression
List<Receiver<String>> owners = new ArrayList<>();
if (typeCheckingContext.delegationMetadata != null
&& objectExpression instanceof VariableExpression
&& ((VariableExpression) objectExpression).getName().equals("owner")
&& ((Variable) objectExpression).getName().equals("owner")
&& /*isNested:*/typeCheckingContext.delegationMetadata.getParent() != null) {
List<Receiver<String>> enclosingClass = Collections.singletonList(
Receiver.make(typeCheckingContext.getEnclosingClassNode()));
addReceivers(owners, enclosingClass, typeCheckingContext.delegationMetadata.getParent(), "owner.");
} else {
/* GRECLIPSE edit -- GROOVY-8965, GROOVY-10180, GROOVY-10668
if (!typeCheckingContext.temporaryIfBranchTypeInformation.isEmpty()) {
List<ClassNode> potentialReceiverType = getTemporaryTypesForExpression(objectExpression);
if (potentialReceiverType != null && !potentialReceiverType.isEmpty()) {
Expand All @@ -3818,9 +3819,13 @@ protected List<Receiver<String>> makeOwnerList(final Expression objectExpression
}
}
}
*/
List<ClassNode> temporaryTypes = getTemporaryTypesForExpression(objectExpression);
if (asBoolean(temporaryTypes)) owners.add(Receiver.make(lowestUpperBound(temporaryTypes)));
// GRECLIPSE end
if (typeCheckingContext.lastImplicitItType != null
&& objectExpression instanceof VariableExpression
&& ((VariableExpression) objectExpression).getName().equals("it")) {
&& ((Variable) objectExpression).getName().equals("it")) {
owners.add(Receiver.make(typeCheckingContext.lastImplicitItType));
}
if (isClassClassNodeWrappingConcreteType(receiver)) {
Expand Down

0 comments on commit 5d64fb8

Please sign in to comment.