Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit481427f

Browse files
drvinkdsyme
authored andcommitted
Don't suggest variables explicitly marked unused (#3706)
* Add new test; fix run.pl regex and affected tests* Don't suggest variables explicitly marked unused
1 parentb714ecb commit481427f

File tree

5 files changed

+16
-3
lines changed

5 files changed

+16
-3
lines changed

‎src/fsharp/ErrorResolutionHints.fs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ let FilterPredictions (idText:string) (suggestionF:ErrorLogger.Suggestions) =
4343
if allSuggestions.Contains idTextthen[]else// some other parsing error occurred
4444
allSuggestions
4545
|> Seq.choose(fun suggestion->
46-
if IsOperatorName suggestionthen Noneelse
46+
// Because beginning a name with _ is used both to indicate an unused
47+
// value as well as to formally squelch the associated compiler
48+
// error/warning (FS1182), we remove such names from the suggestions,
49+
// both to prevent accidental usages as well as to encourage good taste
50+
if IsOperatorName suggestion|| suggestion.StartsWith"_"then Noneelse
4751
letsuggestion:string= demangle suggestion
4852
letsuggestedText= suggestion.ToUpperInvariant()
4953
letsimilarity= EditDistance.JaroWinklerDistance uppercaseText suggestedText

‎tests/fsharpqa/Source/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
//<Expects status="success">section='- ADVANCED - ' ! option=readline kind=OptionSwitch</Expects>
9696
//<Expects status="success">section='- ADVANCED - ' ! option=quotations-debug kind=OptionSwitch</Expects>
9797
//<Expects status="success">section='- ADVANCED - ' ! option=shadowcopyreferences kind=OptionSwitch</Expects>
98+
//<Expects status="success">section='- ADVANCED - ' ! option=simpleresolution kind=OptionUnit</Expects>
9899

99100
// These are for FSC.EXE ONLY:
100101

@@ -121,7 +122,6 @@
121122
//<Expects status="notin">section='- ADVANCED - ' ! option=standalone kind=OptionUnit</Expects>
122123
//<Expects status="notin">section='- ADVANCED - ' ! option=staticlink kind=OptionString</Expects>
123124
//<Expects status="notin">section='- ADVANCED - ' ! option=pdb kind=OptionString</Expects>
124-
//<Expects status="notin">section='- ADVANCED - ' ! option=simpleresolution kind=OptionUnit</Expects>
125125
//<Expects status="notin">section='NoSection ' ! option=generatehtml kind=OptionUnit</Expects>
126126
//<Expects status="notin">section='NoSection ' ! option=htmloutputdir kind=OptionString</Expects>
127127
//<Expects status="notin">section='NoSection ' ! option=htmlcss kind=OptionString</Expects>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//<Expects status="Error" id="FS0039">The value or constructor 'xyz' is not defined.</Expects>
2+
//<Expects>Maybe you want one of the following:</Expects>
3+
//<Expects>\s+xy</Expects>
4+
//<Expects status="notin">\s+_xyz</Expects>
5+
6+
lethober xy _xyz= xyz
7+
8+
exit0

‎tests/fsharpqa/Source/Warnings/env.lst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,4 @@
7878
SOURCE=WarnIfPossiblePropertySetter.fs
7979
SOURCE=DoCannotHaveVisibilityDeclarations.fs
8080
SOURCE=ModuleAbbreviationsArePrivate.fs
81+
SOURCE=DontSuggestIntentionallyUnusedVariables.fs SCFLAGS="--vserrors" # DontSuggestIntentionallyUnusedVariables.fs

‎tests/fsharpqa/Source/run.pl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ ()
646646
push@dontmatch,$2if$2;
647647
}
648648
# test full xml form
649-
elsif (m@//\s*<Expect\w*\s*Status\s*=\s*(notin)\s*>\s*(.*?)\s*<(/Expect|/)\w*>@i) {
649+
elsif (m@//\s*<Expect\w*\s*Status\s*=\s*\"?(notin)\"?\s*>\s*(.*?)\s*<(/Expect|/)\w*>@i) {
650650
push@dontmatch,$2if$2;
651651
}else {
652652
next;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp