Commit 90f0111
committed
Emit
>= 256 (more than 1 byte) are already an error
```fsharp
let _ = "ä"B
// ^^^^
// This byte array literal contains 1 non-ASCII characters. All characters should be < 128y.
// Note: In future F# versions this Warning might be promoted to Error!
```
Note: Issue with trigraph and > 255:
```fsharp
let _ = "\973"B
// ^^^^
// Warning: '\973' is not a valid character literal.
// Note: Currently the value is wrapped around byte range to '\169' [...]
//
// ^^^^^^^
// Warning: This byte array literal contains 1 non-ASCII characters.
```
->
Two warnings for same trigraph:
* Warning for trigraph `\973` > 255. Detected while parsing trigraph. Don't know yet if String or Byte String.
* warning spans just trigraph
* Warning for wrapped value `\169` > 127. Detected while checking Byte String for correct values. Don't have any infos about value (range & notation) any more.
* warning spans full byte string
-> Each Warning is emitted in a different parsing steps.
-> No easy way to reduce to just one warning.
However: Both warnings are correct and warn about a different issues (albeit in same value)
And: should get automatically reduced once out-of-trigraph-range gets promoted to error
**Enhancement**: Count number of invalid chars (2-bytes, >128) in byte array
```fsharp
let _ = "ΩäΩüΩ"B
```
* prev:
`This byte array literal contains characters that do not encode as a single byte`
* now:
`This byte array literal contains 3 characters that do not encode as a single byte`
&&
`This byte array literal contains 2 non-ASCII characters. All characters should be < 128y.`
Note: When checking valid bytes in Byte String, there's no direct mapping to range and notation any more.
-> cannot highlight exact byte string part, but only full byte string.
* Possible Enhancement?: List invalid chars in a certain notation? For example in `\u` notation.
* Pro:
* Gives an idea which chars are incorrect
* Con:
* Might be difficult to process by user because output might be different notation than written in string
* Might be a long list with invalid charsWarning for Byte String Chars > 127 but < 2561 parent 9ce73bb commit 90f0111
File tree
18 files changed
+177
-46
lines changed- src/Compiler
- SyntaxTree
- xlf
- tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis
18 files changed
+177
-46
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
1022 | | - | |
| 1022 | + | |
1023 | 1023 | | |
1024 | 1024 | | |
1025 | 1025 | | |
| |||
1132 | 1132 | | |
1133 | 1133 | | |
1134 | 1134 | | |
| 1135 | + | |
1135 | 1136 | | |
1136 | 1137 | | |
1137 | 1138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
225 | 227 | | |
226 | | - | |
| 228 | + | |
227 | 229 | | |
228 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
229 | 239 | | |
230 | 240 | | |
231 | 241 | | |
232 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
233 | 245 | | |
234 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
235 | 250 | | |
236 | 251 | | |
237 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
138 | 136 | | |
139 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
140 | 144 | | |
141 | 145 | | |
142 | 146 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments