Skip to content

Commit af2ebfa

Browse files
authored
Re-enable unused bindings detection (#18420)
* reenable unused binding detection * fantomas * vsintegration/tests - ignored unused bindings in selected test projects
1 parent a3181c4 commit af2ebfa

39 files changed

+83
-116
lines changed

Directory.Build.props

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
<IgnoreMibc Condition="'$(IgnoreMibc)' == ''">$(DotNetBuildSourceOnly)</IgnoreMibc>
1111
</PropertyGroup>
1212

13-
<PropertyGroup>
14-
<!-- TODO: These need to be removed once we merge/release the new SDK with noward and line fixes. -->
15-
<NoWarn>$(NoWarn);FS0064;FS1182</NoWarn>
16-
</PropertyGroup>
17-
1813
<!--
1914
When developers load the FSharp.Compiler.Service solution we set FSHARPCORE_USE_PACKAGE to true if it hasn't already been set to a value.
2015
This option ensures that building and testing uses the specified FSharp.Core nuget package instead of the local FSharp.Core project.

FSharp.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Benchmarks"
106106
EndProject
107107
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D58BFE8B-7C85-4D3B-B5F3-9A7BB90FF1EE}"
108108
ProjectSection(SolutionItems) = preProject
109+
src\Compiler\default.win32manifest = src\Compiler\default.win32manifest
109110
src\Compiler\FSComp.txt = src\Compiler\FSComp.txt
110111
src\Compiler\FSCompCheck.fsx = src\Compiler\FSCompCheck.fsx
111112
EndProjectSection

FSharpBuild.Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
<SymStoreDirectory>$(ArtifactsDir)\SymStore</SymStoreDirectory>
2828
<ProtoOutputPath>$(ArtifactsDir)\Bootstrap</ProtoOutputPath>
2929
<ValueTupleImplicitPackageVersion>4.4.0</ValueTupleImplicitPackageVersion>
30-
<WarningsAsErrors>1182;0025;$(WarningsAsErrors)</WarningsAsErrors>
30+
<WarnOn>$(WarnOn);1182</WarnOn>
31+
<WarningsAsErrors>0025;$(WarningsAsErrors)</WarningsAsErrors>
3132
<OtherFlags>$(OtherFlags) --nowarn:3384</OtherFlags>
3233
<OtherFlags>$(OtherFlags) --times --nowarn:75</OtherFlags>
3334
<OtherFlags Condition="$(AdditionalFscCmdFlags) != ''">$(OtherFlags) $(AdditionalFscCmdFlags)</OtherFlags>

src/Compiler/Checking/Expressions/CheckExpressions.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ let TcConst (cenv: cenv) (overallTy: TType) m env synConst =
813813
warning(Error(FSComp.SR.tcImplicitMeasureFollowingSlash(), m))
814814
let factor1 = ms1 |> Option.defaultValue (SynMeasure.One Range.Zero)
815815
Measure.Prod(tcMeasure factor1, Measure.Inv (tcMeasure ms2), ms.Range)
816-
| SynMeasure.Divide(measure1 = ms1; measure2 = ms2; range= m) ->
816+
| SynMeasure.Divide(measure1 = ms1; measure2 = ms2) ->
817817
let factor1 = ms1 |> Option.defaultValue (SynMeasure.One Range.Zero)
818818
Measure.Prod(tcMeasure factor1, Measure.Inv (tcMeasure ms2), ms.Range)
819819
| SynMeasure.Seq(mss, _) -> ProdMeasures (List.map tcMeasure mss)
@@ -10686,7 +10686,7 @@ and TcMatchClauses cenv inputTy (resultTy: OverallTy) env tpenv clauses =
1068610686
resultList,tpEnv
1068710687

1068810688
and TcMatchClause cenv inputTy (resultTy: OverallTy) env isFirst tpenv synMatchClause =
10689-
let (SynMatchClause(synPat, synWhenExprOpt, synResultExpr, patm, spTgt, trivia)) = synMatchClause
10689+
let (SynMatchClause(synPat, synWhenExprOpt, synResultExpr, patm, spTgt, _trivia)) = synMatchClause
1069010690

1069110691
let isTrueMatchClause =
1069210692
if synMatchClause.IsTrueMatchClause then

src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallT
270270

271271
let tclauses, tpenv =
272272
(tpenv, clauses)
273-
||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, _, sp, trivia) as clause) ->
273+
||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, _, sp, _trivia) as clause) ->
274274
let isTrueMatchClause =
275275
if clause.IsTrueMatchClause then
276276
TcTrueMatchClause.Yes
@@ -319,7 +319,7 @@ let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallT
319319
// Compile the pattern twice, once as a filter with all succeeding targets returning "1", and once as a proper catch block.
320320
let clauses, tpenv =
321321
(tpenv, withList)
322-
||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, m, sp, trivia) as clause) ->
322+
||> List.mapFold (fun tpenv (SynMatchClause(pat, cond, innerComp, m, sp, _trivia) as clause) ->
323323
let isTrueMatchClause =
324324
if clause.IsTrueMatchClause then
325325
TcTrueMatchClause.Yes

src/Compiler/Checking/TailCallChecks.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ let CheckModuleBinding cenv (isRec: bool) (TBind _ as bind) =
794794
| Expr.Op(args = exprs) -> exprs |> Seq.iter (checkTailCall insideSubBindingOrTry)
795795
| Expr.Sequential(expr1 = expr1; expr2 = expr2) ->
796796
match expr1 with
797-
| Expr.Op(args = exprs; op = TOp.IntegerForLoop _) -> checkTailCall insideSubBindingOrTry expr1
797+
| Expr.Op(op = TOp.IntegerForLoop _) -> checkTailCall insideSubBindingOrTry expr1
798798
| _ -> ()
799799

800800
checkTailCall insideSubBindingOrTry expr2

src/Compiler/Checking/infos.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,10 +1438,10 @@ type MethInfo =
14381438
match retTy with
14391439
| Some retTy -> isTyparTy g retTy
14401440
| None -> false
1441-
| MethInfoWithModifiedReturnType(_,retTy) -> false
1441+
| MethInfoWithModifiedReturnType _ -> false
14421442
| DefaultStructCtor _ -> false
14431443
#if !NO_TYPEPROVIDERS
1444-
| ProvidedMeth(amap, mi, _, m) -> false
1444+
| ProvidedMeth _ -> false
14451445
#endif
14461446

14471447
/// Get the ParamData objects for the parameters of a MethInfo

src/Compiler/CodeGen/EraseUnions.fs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,6 @@ let convAlternativeDef
12111211
let basicCtorFields =
12121212
basicFields
12131213
|> List.map (fun fdef ->
1214-
let existingAttrs = fdef.CustomAttrs.AsArray()
12151214
let nullableAttr = getFieldsNullability g fdef |> Option.toList
12161215
fdef.Name, fdef.FieldType, nullableAttr)
12171216

src/Compiler/Driver/CompilerDiagnostics.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ type Exception with
678678
showNullnessAnnotations = Some true
679679
}
680680

681-
let t1, t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2
681+
let t1, _t2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2
682682

683683
os.Append(ConstraintSolverNullnessWarningEquivWithTypesE().Format t1) |> ignore
684684

src/Compiler/FSharp.Compiler.Service.fsproj

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
<NoWarn>$(NoWarn);75</NoWarn> <!-- InternalCommandLineOption -->
1111
<NoWarn>$(NoWarn);1204</NoWarn> <!-- This construct is for use in the FSharp.Core library and should not be used directly -->
1212
<NoWarn>$(NoWarn);NU5125</NoWarn>
13-
<NoWarn>$(NoWarn);64;1182;1204</NoWarn> <!--Temporary fix for sourcebuild -->
14-
<OtherFlags>$(OtherFlags) --warnaserror-:1182</OtherFlags> <!--Temporary fix for sourcebuild -->
13+
<NoWarn>$(NoWarn);64;1204</NoWarn> <!--Temporary fix for sourcebuild -->
1514
<AssemblyName>FSharp.Compiler.Service</AssemblyName>
1615
<AllowCrossTargeting>true</AllowCrossTargeting>
1716
<DefineConstants>$(DefineConstants);COMPILER</DefineConstants>
@@ -26,11 +25,6 @@
2625
<TargetFrameworks Condition=" '$(OfficialBuildId)' == '' AND '$(FSharpNetCoreProductTargetFramework)' != '' AND '$(Configuration)' != 'Proto' AND '$(SKIP_NETCURRENT_FSC_BUILD)' != 'true' ">$(FSharpNetCoreProductTargetFramework);$(TargetFrameworks)</TargetFrameworks>
2726
<DefineConstants Condition="'$(FSHARPCORE_USE_PACKAGE)' == 'true'">$(DefineConstants);FSHARPCORE_USE_PACKAGE</DefineConstants>
2827
<OtherFlags>$(OtherFlags) --extraoptimizationloops:1</OtherFlags>
29-
30-
<!-- TODO: This needs to be re-enabled once we merge/release the new SDK with noward and line fixes. -->
31-
<!-- 1182: Unused variables -->
32-
<OtherFlags>$(OtherFlags) --nowarn:1182</OtherFlags>
33-
3428
<!-- 3218: ArgumentsInSigAndImplMismatch -->
3529
<OtherFlags>$(OtherFlags) --warnon:3218</OtherFlags>
3630
<!-- 3390: xmlDocBadlyFormed -->

0 commit comments

Comments
 (0)