Skip to content

Commit

Permalink
Fix unprintable class when param types are inferred from assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
kelloggm committed Jul 7, 2020
1 parent fa95fd5 commit 423d0a2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ public void updateFromLocalAssignment(

String className = getEnclosingClassName(lhs);
String jaifPath = storage.getJaifPath(className);
AClass clazz = storage.getAClass(className, jaifPath);
AClass clazz =
storage.getAClass(
className,
jaifPath,
(ClassSymbol) TreeUtils.elementFromDeclaration(classTree));
ExecutableElement methodElt = TreeUtils.elementFromDeclaration(methodTree);
AMethod method = clazz.methods.getVivify(JVMNames.getJVMMethodSignature(methodElt));
method.setFieldsFromMethodElement(methodElt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void writeToFile(
/**
* Updates the symbol information stored in AClass for the given class. May be called multiple
* times (and needs to be if the second parameter was null the first time it was called; only
* some calls provide the symbol inforamtion).
* some calls provide the symbol information).
*
* @param aClass the class representation in which the symbol information is to be updated
* @param classSymbol the source of the symbol information; may be null, in which case this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,11 @@ void test() {
expectsSibling1(field2);
}
}

class AssignParam {
public void f(@WholeProgramInferenceBottom Object param) {
// :: error: assignment.type.incompatible
param = ((@Top Object) null);
}
}
}

0 comments on commit 423d0a2

Please sign in to comment.