-
Notifications
You must be signed in to change notification settings - Fork 833
Closed
Closed
Copy link
Labels
Area-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnosticsBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
Description
\DDD (where D indicates a decimal digit; range of 000 - 255; for example, \231 = "ç")
BUT: a value > 255 is accepted too -- but gets wrapped into range (% 256):
> int 'Ω';;
val it: int = 937
> "\937";;
val it: string = "©"
> int ("\937"[0]);;
val it: int = 169
> 937 % 256;;
val it: int = 169Expected behavior
Should be compiler error, like in char:
> '\937';;
^^^^^^
stdin(85,1): error FS1158: This is not a valid character literalActual behavior
Decimal > 255 is accepted and wrapped into byte range.
I think issue is here:
Lines 1185 to 1192 in 443b3ab
| | trigraph | |
| { let (buf, _fin, m, kind, args) = sargs | |
| let s = lexeme lexbuf | |
| addByteChar buf (trigraph s.[1] s.[2] s.[3]) | |
| if not skip then | |
| STRING_TEXT (LexCont.String(args.ifdefStack, args.stringNest, LexerStringStyle.SingleQuote, kind, args.interpolationDelimiterLength, m)) | |
| else | |
| singleQuoteString sargs skip lexbuf } |
There's no range check and
addByteChar then wraps the value to byte range
I'm going to fix this together with the other char notations issues.
Related information
- Operating system: Windows 11 x64
dotnet --version:7.0.307,8.0.100-preview.7.23376.3
Metadata
Metadata
Assignees
Labels
Area-Diagnosticsmistakes and possible improvements to diagnosticsmistakes and possible improvements to diagnosticsBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Type
Projects
Status
Done