forked from typetools/checker-framework
-
Notifications
You must be signed in to change notification settings - Fork 29
Apply flow-refinement for receivers even when using getAnnotatedTypeLhs
#434
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
1e7e323
apply flow-refinement for receiver when using getAnnotatedTypeLHS
AndrewShf c3a50df
fix misc
AndrewShf 4081d89
Merge branch 'master' into add_receiver_refinement
wmdietl 454e897
Merge branch 'master' into add_receiver_refinement
wmdietl 7d6622b
Merge branch 'master' into add_receiver_refinement
wmdietl aa11d1c
Merge branch 'master' into add_receiver_refinement
wmdietl d75b31d
grammar fix
AndrewShf ce3bcc2
add more explanation to the feature
AndrewShf b133a42
add javadoc
AndrewShf 8de8fdc
change method visibility
AndrewShf cbd7823
add more explanation
AndrewShf 54100f5
fix misc
AndrewShf 4cd6a95
Merge branch 'master' into add_receiver_refinement
AndrewShf c5c61a4
Merge branch 'master' into add_receiver_refinement
wmdietl 5e27d51
Apply suggestions from code review
AndrewShf 7e509ad
address comments
AndrewShf 0254f60
Refer to issue
wmdietl cab1c8b
Merge branch 'master' into add_receiver_refinement
wmdietl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import viewpointtest.quals.A; | ||
| import viewpointtest.quals.B; | ||
| import viewpointtest.quals.ReceiverDependentQual; | ||
| import viewpointtest.quals.Top; | ||
|
|
||
| @ReceiverDependentQual | ||
| class TestGetAnnotatedLhs { | ||
| @ReceiverDependentQual Object f; | ||
|
|
||
| @SuppressWarnings({ | ||
| "inconsistent.constructor.type", | ||
| "super.invocation.invalid", | ||
| "cast.unsafe.constructor.invocation" | ||
| }) | ||
| @ReceiverDependentQual | ||
| TestGetAnnotatedLhs() { | ||
| this.f = new @ReceiverDependentQual Object(); | ||
| } | ||
|
|
||
| @SuppressWarnings({"cast.unsafe.constructor.invocation"}) | ||
| void topWithRefinement() { | ||
| TestGetAnnotatedLhs a = new @A TestGetAnnotatedLhs(); | ||
| TestGetAnnotatedLhs top = new @Top TestGetAnnotatedLhs(); | ||
| top = a; | ||
| // When checking the below assignment, GenericAnnotatedTypeFactory#getAnnotatedTypeLhs() | ||
| // will be called to get the type of the lhs tree (top.f). | ||
| // Previously this method will completely disable flow refinment, and top.f will have type | ||
| // @Top and thus accept the below assingment. But we should reject it, as top | ||
| // is refined to be @A before. As long as top is still pointing to the @A object, top.f | ||
| // will have type @A, which is not the supertype of @B. | ||
| // :: error: (assignment.type.incompatible) | ||
| top.f = new @B Object(); | ||
| top.f = new @A Object(); // no error here | ||
| } | ||
|
|
||
| @SuppressWarnings({"cast.unsafe.constructor.invocation"}) | ||
| void topWithoutRefinement() { | ||
| TestGetAnnotatedLhs top = new @Top TestGetAnnotatedLhs(); | ||
| // See #576. | ||
| // :TODO: error: (assignment.type.incompatible) | ||
| top.f = new @B Object(); | ||
| top.f = new @A Object(); | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.