-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LSP: add call inlays for complex literals (#25202)
Closes #25115. This just involves adding some smarter AST inspection to detect what we want to treat like "literals" for the purposes of call inlays. Specifically, I've opted for the following: 1. Complex number literals should only have 'two' components; in the same way that `1+1` is not a literal, neither is `1 + 1i + 1`. On the other hand, `1 + 1i` _is_ a literal. 2. The numbers can be in any order: `1 + 1i` or `1i + 1`. This is a bit liberal, but I think it's reasonable. 3. Double negation is not allowed, neither for real/imaginary numbers nor complex literals. * So, `-4` is a "literal", but `- -4` is not. * Similarly, `4 - (-i)` is not a literal. I've un-xfailed the test that locked this down, and added a separate test for negative numbers. Reviewed by @jabraham17 -- thanks! ## Testing - [x] `make test-cls`
- Loading branch information
Showing
2 changed files
with
90 additions
and
3 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