-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce correct type-use annotation locations for nested types (#1045)
Enforce correct type-use annotation locations for nested types as per JSpecify norms. We enforce type-use annotations to be on the inner class and raise an error if they are not. For annotations that are both type use and declaration, we raise an error at an invalid location. **Current behavior** ``` // All three are ok @nullable A.B.C foo1 = null; A.@nullable B.C foo2 = null; A.B.@nullable C foo3 = null; ``` **New behavior** ``` // BUG: Diagnostic contains: Type-use nullability annotations should be applied on inner class @nullable A.B.C foo1 = null; // BUG: Diagnostic contains: Type-use nullability annotations should be applied on inner class A.@nullable B.C foo2 = null; A.B.@nullable C foo3 = null; ``` For annotations which are both declaration and annotation and type-use, only `foo2` throws an error since the location isn't apt for either scenarios --------- Co-authored-by: Manu Sridharan <[email protected]>
- Loading branch information
1 parent
9eea2be
commit cc5ef65
Showing
4 changed files
with
298 additions
and
26 deletions.
There are no files selected for viewing
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
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
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
Oops, something went wrong.