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

Commit203d70e

Browse files
dsymeKevinRansom
authored andcommitted
show type of ignored expression (#4197)
* show type of ignored expression* fix tests* fix tests* fix test
1 parent4f39f97 commit203d70e

File tree

37 files changed

+190
-182
lines changed

37 files changed

+190
-182
lines changed

‎src/fsharp/CompileOps.fs‎

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -532,11 +532,11 @@ let UseOfAddressOfOperatorE() = DeclareResourceString("UseOfAddressOfOperator",
532532
letDefensiveCopyWarningE()= DeclareResourceString("DefensiveCopyWarning","%s")
533533
letDeprecatedThreadStaticBindingWarningE()= DeclareResourceString("DeprecatedThreadStaticBindingWarning","")
534534
letFunctionValueUnexpectedE()= DeclareResourceString("FunctionValueUnexpected","%s")
535-
letUnitTypeExpectedE()= DeclareResourceString("UnitTypeExpected","")
536-
letUnitTypeExpectedWithEqualityE()= DeclareResourceString("UnitTypeExpectedWithEquality","")
537-
letUnitTypeExpectedWithPossiblePropertySetterE()= DeclareResourceString("UnitTypeExpectedWithPossiblePropertySetter","%s%s")
538-
letUnitTypeExpectedWithPossibleAssignmentE()= DeclareResourceString("UnitTypeExpectedWithPossibleAssignment","%s")
539-
letUnitTypeExpectedWithPossibleAssignmentToMutableE()= DeclareResourceString("UnitTypeExpectedWithPossibleAssignmentToMutable","%s")
535+
letUnitTypeExpectedE()= DeclareResourceString("UnitTypeExpected","%s")
536+
letUnitTypeExpectedWithEqualityE()= DeclareResourceString("UnitTypeExpectedWithEquality","%s")
537+
letUnitTypeExpectedWithPossiblePropertySetterE()= DeclareResourceString("UnitTypeExpectedWithPossiblePropertySetter","%s%s%s")
538+
letUnitTypeExpectedWithPossibleAssignmentE()= DeclareResourceString("UnitTypeExpectedWithPossibleAssignment","%s%s")
539+
letUnitTypeExpectedWithPossibleAssignmentToMutableE()= DeclareResourceString("UnitTypeExpectedWithPossibleAssignmentToMutable","%s%s")
540540
letRecursiveUseCheckedAtRuntimeE()= DeclareResourceString("RecursiveUseCheckedAtRuntime","")
541541
letLetRecUnsound1E()= DeclareResourceString("LetRecUnsound1","%s")
542542
letLetRecUnsound2E()= DeclareResourceString("LetRecUnsound2","%s%s")
@@ -1292,28 +1292,32 @@ let OutputPhasedErrorR (os:StringBuilder) (err:PhasedDiagnostic) =
12921292
os.Append(DeprecatedThreadStaticBindingWarningE().Format)|> ignore
12931293

12941294
| FunctionValueUnexpected(denv, ty,_)->
1295-
// REVIEW: consider if we need to show _cxs (the type parameter constraints)
12961295
letty,_cxs= PrettyTypes.PrettifyType denv.g ty
1297-
os.Append(FunctionValueUnexpectedE().Format(NicePrint.stringOfTy denv ty))|> ignore
1296+
leterrorText= FunctionValueUnexpectedE().Format(NicePrint.stringOfTy denv ty)
1297+
os.Append errorText|> ignore
12981298

1299-
| UnitTypeExpected(_,_,_)->
1300-
letwarningText= UnitTypeExpectedE().Format
1299+
| UnitTypeExpected(denv, ty,_)->
1300+
letty,_cxs= PrettyTypes.PrettifyType denv.g ty
1301+
letwarningText= UnitTypeExpectedE().Format(NicePrint.stringOfTy denv ty)
13011302
os.Append warningText|> ignore
13021303

1303-
| UnitTypeExpectedWithEquality(_)->
1304-
letwarningText= UnitTypeExpectedWithEqualityE().Format
1304+
| UnitTypeExpectedWithEquality(denv, ty,_)->
1305+
letty,_cxs= PrettyTypes.PrettifyType denv.g ty
1306+
letwarningText= UnitTypeExpectedWithEqualityE().Format(NicePrint.stringOfTy denv ty)
13051307
os.Append warningText|> ignore
13061308

1307-
| UnitTypeExpectedWithPossiblePropertySetter(_,_, bindingName, propertyName,_)->
1308-
letwarningText= UnitTypeExpectedWithPossiblePropertySetterE().Format bindingName propertyName
1309+
| UnitTypeExpectedWithPossiblePropertySetter(denv, ty, bindingName, propertyName,_)->
1310+
letty,_cxs= PrettyTypes.PrettifyType denv.g ty
1311+
letwarningText= UnitTypeExpectedWithPossiblePropertySetterE().Format(NicePrint.stringOfTy denv ty) bindingName propertyName
13091312
os.Append warningText|> ignore
13101313

1311-
| UnitTypeExpectedWithPossibleAssignment(_,_, isAlreadyMutable, bindingName,_)->
1314+
| UnitTypeExpectedWithPossibleAssignment(denv, ty, isAlreadyMutable, bindingName,_)->
1315+
letty,_cxs= PrettyTypes.PrettifyType denv.g ty
13121316
letwarningText=
13131317
if isAlreadyMutablethen
1314-
UnitTypeExpectedWithPossibleAssignmentToMutableE().Format bindingName
1318+
UnitTypeExpectedWithPossibleAssignmentToMutableE().Format(NicePrint.stringOfTy denv ty)bindingName
13151319
else
1316-
UnitTypeExpectedWithPossibleAssignmentE().Format bindingName
1320+
UnitTypeExpectedWithPossibleAssignmentE().Format(NicePrint.stringOfTy denv ty)bindingName
13171321
os.Append warningText|> ignore
13181322

13191323
| RecursiveUseCheckedAtRuntime_->

‎src/fsharp/FSStrings.resx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -886,19 +886,19 @@
886886
<value>This expression is a function value, i.e. is missing arguments. Its type is {0}.</value>
887887
</data>
888888
<dataname="UnitTypeExpected"xml:space="preserve">
889-
<value>The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.</value>
889+
<value>The result of this expressionhas type '{0}' andis implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.</value>
890890
</data>
891891
<dataname="UnitTypeExpectedWithEquality"xml:space="preserve">
892-
<value>The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.</value>
892+
<value>The result of this equality expressionhas type '{0}' andis implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.</value>
893893
</data>
894894
<dataname="UnitTypeExpectedWithPossiblePropertySetter"xml:space="preserve">
895-
<value>The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '&lt;-' operator e.g. '{0}.{1}&lt;- expression'.</value>
895+
<value>The result of this equality expressionhas type '{0}' andis implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '&lt;-' operator e.g. '{1}.{2}&lt;- expression'.</value>
896896
</data>
897897
<dataname="UnitTypeExpectedWithPossibleAssignment"xml:space="preserve">
898-
<value>The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '&lt;-' operator e.g. '{0}&lt;- expression'.</value>
898+
<value>The result of this equality expressionhas type '{0}' andis implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '&lt;-' operator e.g. '{1}&lt;- expression'.</value>
899899
</data>
900900
<dataname="UnitTypeExpectedWithPossibleAssignmentToMutable"xml:space="preserve">
901-
<value>The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '&lt;-' operator e.g. '{0}&lt;- expression'.</value>
901+
<value>The result of this equality expressionhas type '{0}' andis implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '&lt;-' operator e.g. '{1}&lt;- expression'.</value>
902902
</data>
903903
<dataname="RecursiveUseCheckedAtRuntime"xml:space="preserve">
904904
<value>This recursive use will be checked for initialization-soundness at runtime. This warning is usually harmless, and may be suppressed by using '#nowarn "21"' or '--nowarn:21'.</value>

‎src/fsharp/service/service.fs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,6 +1519,10 @@ module internal Parser =
15191519
if source.Length=0||not(source.[source.Length-1]='\n')then source+"\n"else source
15201520

15211521
letmatchBraces(source,fileName,options:FSharpParsingOptions,userOpName:string)=
1522+
letdelayedLogger= CapturingErrorLogger("matchBraces")
1523+
use _unwindEL= PushErrorLoggerPhaseUntilUnwind(fun _-> delayedLogger)
1524+
use _unwindBP= PushThreadBuildPhaseUntilUnwind BuildPhase.Parse
1525+
15221526
Trace.TraceInformation("FCS: {0}.{1} ({2})", userOpName,"matchBraces", fileName)
15231527

15241528
// Make sure there is an ErrorLogger installed whenever we do stuff that might record errors, even if we ultimately ignore the errors

‎src/fsharp/xlf/FSStrings.cs.xlf‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,28 +1283,28 @@
12831283
<note />
12841284
</trans-unit>
12851285
<trans-unitid="UnitTypeExpected">
1286-
<source>The result of this expression is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |&gt; ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.</source>
1287-
<targetstate="translated">Výsledek tohoto výrazu se implicitně ignoruje. Zvažte možnost použít ignore, aby se tato hodnota explicitně zahodila, třeba expr |&gt; ignore, nebo let, aby se výsledek svázal s názvem, třeba let result = expr.</target>
1286+
<source>The result of this expressionhas type '{0}' andis implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |&gt; ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.</source>
1287+
<targetstate="needs-review-translation">Výsledek tohoto výrazu se implicitně ignoruje. Zvažte možnost použít ignore, aby se tato hodnota explicitně zahodila, třeba expr |&gt; ignore, nebo let, aby se výsledek svázal s názvem, třeba let result = expr.</target>
12881288
<note />
12891289
</trans-unit>
12901290
<trans-unitid="UnitTypeExpectedWithEquality">
1291-
<source>The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.</source>
1292-
<targetstate="translated">Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz.</target>
1291+
<source>The result of this equality expressionhas type '{0}' andis implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.</source>
1292+
<targetstate="needs-review-translation">Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz.</target>
12931293
<note />
12941294
</trans-unit>
12951295
<trans-unitid="UnitTypeExpectedWithPossiblePropertySetter">
1296-
<source>The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '&lt;-' operator e.g. '{0}.{1}&lt;- expression'.</source>
1297-
<targetstate="translated">Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli nastavit hodnotu na vlastnost, použijte operátor&lt;-, např. {0}.{1}&lt;- výraz.</target>
1296+
<source>The result of this equality expressionhas type '{0}' andis implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '&lt;-' operator e.g. '{1}.{2}&lt;- expression'.</source>
1297+
<targetstate="needs-review-translation">Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli nastavit hodnotu na vlastnost, použijte operátor&lt;-, např. {1}.{2}&lt;- výraz.</target>
12981298
<note />
12991299
</trans-unit>
13001300
<trans-unitid="UnitTypeExpectedWithPossibleAssignment">
1301-
<source>The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '&lt;-' operator e.g. '{0}&lt;- expression'.</source>
1302-
<targetstate="translated">Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli mutovat hodnotu, označte hodnotu jako mutable a použijte operátor&lt;-, např. {0}&lt;- výraz.</target>
1301+
<source>The result of this equality expressionhas type '{0}' andis implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '&lt;-' operator e.g. '{1}&lt;- expression'.</source>
1302+
<targetstate="needs-review-translation">Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli mutovat hodnotu, označte hodnotu jako mutable a použijte operátor&lt;-, např. {1}&lt;- výraz.</target>
13031303
<note />
13041304
</trans-unit>
13051305
<trans-unitid="UnitTypeExpectedWithPossibleAssignmentToMutable">
1306-
<source>The result of this equality expression is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '&lt;-' operator e.g. '{0}&lt;- expression'.</source>
1307-
<targetstate="translated">Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli mutovat hodnotu, použijte operátor&lt;-, např. {0}&lt;- výraz.</target>
1306+
<source>The result of this equality expressionhas type '{0}' andis implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '&lt;-' operator e.g. '{1}&lt;- expression'.</source>
1307+
<targetstate="needs-review-translation">Výsledek tohoto výrazu rovnosti se implicitně zruší. Zvažte vytvoření vazby mezi výsledkem a názvem pomocí klíčového slova let, např. let výsledek = výraz. Pokud jste chtěli mutovat hodnotu, použijte operátor&lt;-, např. {1}&lt;- výraz.</target>
13081308
<note />
13091309
</trans-unit>
13101310
<trans-unitid="RecursiveUseCheckedAtRuntime">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp