Repository navigation
Allow shorter signed hex literals with appropriate type suffixes - #11844
Merged
Aditya Patwardhan (adityapatwardhan) merged 4 commits intoApr 20, 2020
Merged
Aditya Patwardhan (adityapatwardhan) merged 4 commits into
Aditya Patwardhan (adityapatwardhan) merged 4 commits into
Conversation
See PowerShell#11823 for context and discussion. This change allows shorter hex literals to be treated as signed, if the specified type suffix is a signed type with correct hex lengths. For example, 0xFFFFs now parses correctly to -1 instead of erroring.
Rain Sallow (/u/ta11ow) (vexx32)
requested a review
from Dongbo Wang (daxian-dbw)
as a code owner
February 13, 2020 04:46
|
|
||
|
|
||
| // If we're expecting a sign bit, remove the leading 0 added in ScanNumberHelper | ||
| if (!suffix.HasFlag(NumberSuffixFlags.Unsigned)) |
Collaborator
There was a problem hiding this comment.
Why is this a dup of 3700 line?
Collaborator
Author
There was a problem hiding this comment.
Oh, weird. Guessing a copy-paste error. Thanks for noticing that! I'll edit the duplicate segment out. 💖
Rain Sallow (/u/ta11ow) (vexx32)
force-pushed
the
Hex/FixSignedLiterals
branch
from
February 13, 2020 06:24
2900fd4 to
dfe7feb
Compare
Ilya (iSazonov)
approved these changes
Feb 14, 2020
Ilya (iSazonov)
left a comment
Collaborator
There was a problem hiding this comment.
LGTM with one minor comment.
Comment on lines
+5015
to
+5016
| if (strNum == null) | ||
| { return ScanGenericToken(c); } |
Member
|
Dongbo Wang (@daxian-dbw) The change is in the tokenizer, I would like you to have a look. |
Aditya Patwardhan (adityapatwardhan)
approved these changes
Apr 7, 2020
Dongbo Wang (daxian-dbw)
approved these changes
Apr 20, 2020
|
🎉 Handy links: |
Closed
1 of 12 tasks
Collaborator
|
BackPort-7.0.x-Consider is asked in #14302 |
Member
|
Steve Lee (@SteveL-MSFT) / Joey Aiello (@joeyaiello) We need you comment about whether this should be back ported to 7.0.x? |
Member
|
Steve Lee (@SteveL-MSFT) Do we want to backport this? |
Thatgfsj (Thatgfsj)
pushed a commit
to Thatgfsj-contribs/PowerShell
that referenced
this pull request
Aug 6, 2026
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
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.
PR Summary
This change allows shorter hex literals to be treated as signed, if the specified type suffix is a signed type with correct hex lengths. For example,
0xFFFFsnow parses correctly to -1 instead of erroring. Default behaviour without a specific suffix and/or with explicit unsigned suffixes remains as it was.PR Context
Resolves #11823. See the issue for further context and discussion.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.