-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warnings for invalid #nowarn arguments #17871
base: main
Are you sure you want to change the base?
Conversation
❗ Release notes required
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few comments inline
let rxOptions = RegexOptions.CultureInvariant | ||
|
||
let getNumber regexString failAction = | ||
let mtch = Regex(regexString, rxOptions).Match(numStr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think regex makes the code easier to read.
else | ||
(Warning 203, Line 3, Col 1, Line 3, Col 44, "Invalid warning number 'FS'") | ||
(Warning 203, Line 3, Col 9, Line 3, Col 11, "Invalid warning number 'FS'"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just underline the warning number now. I think that is an improvement
@@ -128,12 +145,34 @@ module DoBinding = | |||
(Warning 1104, Line 5, Col 15, Line 5, Col 31, "Identifiers containing '@' are reserved for use in F# code generation") | |||
(Error 3350, Line 2, Col 9, Line 2, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") | |||
(Error 3350, Line 2, Col 12, Line 2, Col 18, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") | |||
(Warning 203, Line 2, Col 26, Line 2, Col 34, """Invalid warning number '"FS3221"'""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is "FS3221" invalid? it wasn't before?
(Error 3350, Line 4, Col 5, Line 4, Col 7, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") | ||
(Error 3350, Line 5, Col 5, Line 5, Col 11, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") | ||
(Error 3350, Line 6, Col 5, Line 6, Col 9, "Feature '# directives with non-quoted string arguments' is not available in F# 8.0. Please use language version 9.0 or greater.") | ||
(Warning 203, Line 7, Col 5, Line 7, Col 9, """Invalid warning number '"FS"'"""); | ||
(Warning 203, Line 8, Col 5, Line 8, Col 13, """Invalid warning number '"FSBLAH"'"""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old compiler was pretty lax about what could be a warning prefix and what couldn't. For a refactoring the tests shouldn't really change. It looks like you have chosen to disallow all error prefix text other than FS.
This will cause developers to have to fix places in their source and projects where nowarns include non FS prefixes. We would prefer them not to have to do to do that.
Sometimes when the existing bugs are not terrible we leave them be, rather than causing everyone makework.
@@ -1005,6 +1005,16 @@ let parsedHashDirectiveArguments (input: ParsedHashDirectiveArgument list) (lang | |||
| false -> None) | |||
input | |||
|
|||
let parsedHashDirectiveArgumentsNoCheck (input: ParsedHashDirectiveArgument list) (langVersion: LanguageVersion) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like langversion is not used here, and we have broken the detection of unused symbols
Description
Fixes #17870
Also centralizes the distributed logic for processing #nowarn arguments, for better maintainability.
Checklist