New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correct the type of "this" #3659
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…anUp # Conflicts: # javacutil/src/main/java/org/checkerframework/javacutil/ElementUtils.java
…anUp # Conflicts: # framework/src/main/java/org/checkerframework/framework/type/AnnotatedTypeFactory.java
mernst
approved these changes
Sep 12, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable, but tests are not yet passing.
smillst
added a commit
that referenced
this pull request
Oct 20, 2020
Defaulting rules for the primary annotation of an intersection type: 1. One or more of the bounds have an explicit annotation: the default annotation is the first explicit annotation. (I tried making the default the glb of the (explicit or defaulted) annotations on the bounds, but I found this confusing in the case of casts. We can discuss this further.) 2. Zero bounds have an explicit annotation: the default annotation of the location is applied. (So, either explicit upper bound defaults, or for casts, the annotation of the cast expression.) Warning: If any explicit annotation on a bound is not the same as the primary annotation, then a warning is issued. (I was going to put this in a separate pull request, but it needs to be in this one so that the test cases are easier to understand.) Changes to AnnotatedIntersectionType: 1. Adding a primary annotation to an intersection type causes that annotation to be copied to its bounds. This is similar to what happens when an annotation is added to a type variable. 2. New method `getBounds` returns a list of the bounds of the intersection type. (This used to be done via `directSuperTypes` method. 3. The bounds can be any AnnotatedTypeMirror if the intersection arises from capture conversion. Fixes #868; Fixes #3349; Fixes #3362; Fixes #3659.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request corrects the type of both implicit and explicit
this
references by correctly computing the enclosing type ofthis
.This pull request fixes two kinds of bugs:
Outer.this
when used in an inner class. (Issues Incorrect annotations on nested class receivers #352, TreatClassName.this
likethis
#2208, and Framework ignores annotations on outer types #3561.)Outer.this
when used in an anonymous class declared in a constructor. (Issues Nullness Checker nested class initialization #354, part of Annonymous class in field initializer needs to treat surrounding class as under initialization #904, and False negative: Nullness Checker allows leaking@UnderInitialization this
to anonymous class instance #3408)#409 (and other duplicate issues) is a related bug in the Initialization Checker, but isn't fixed by this PR.
Closes #352, closes #354, closes #2208, closes #3266, closes #3408 and closes #3561.
Merge with typetools/checker-framework-inference#174.