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

Commit3e71220

Browse files
kasper3KevinRansom
kasper3
authored andcommitted
Add WarningsNotAsErrors option (dotnet#4562)
* Add WarningsNotAsErrors optionCorresponding compiler option is `warnaswarn`.* Use `--warnaserror-` instead of new option* Add a unit test for WarningsNotAsErrors
1 parent1f07561 commit3e71220

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

‎src/fsharp/FSharp.Build/Fsc.fs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ type public Fsc () as this =
7373
let mutabletreatWarningsAsErrors:bool=false
7474
let mutableuseStandardResourceNames:bool=false
7575
let mutablewarningsAsErrors:string=null
76+
let mutablewarningsNotAsErrors:string=null
7677
let mutableversionFile:string=null
7778
let mutablewarningLevel:string=null
7879
let mutablewin32res:string=null
@@ -195,6 +196,11 @@ type public Fsc () as this =
195196

196197
builder.AppendSwitchIfNotNull("--warnaserror:", warningsAsErrorsArray,",")
197198

199+
// WarningsNotAsErrors
200+
match warningsNotAsErrorswith
201+
|null->()
202+
|_-> builder.AppendSwitchIfNotNull("--warnaserror-:", warningsNotAsErrors.Split([|' ';';';','|], StringSplitOptions.RemoveEmptyEntries),",")
203+
198204
// Win32ResourceFile
199205
builder.AppendSwitchIfNotNull("--win32res:", win32res)
200206

@@ -448,6 +454,10 @@ type public Fsc () as this =
448454
with get()= warningsAsErrors
449455
andset(s)= warningsAsErrors<- s
450456

457+
memberfsc.WarningsNotAsErrors
458+
with get()= warningsNotAsErrors
459+
andset(s)= warningsNotAsErrors<- s
460+
451461
memberfsc.VisualStudioStyleErrors
452462
with get()= vserrors
453463
andset(p)= vserrors<- p

‎vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectConfig.cs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,18 @@ public string TreatSpecificWarningsAsErrors
554554
}
555555
}
556556

557+
publicstringTreatSpecificWarningsAsWarnings
558+
{
559+
get
560+
{
561+
returnGetConfigurationProperty(ProjectFileConstants.WarningsNotAsErrors,false);
562+
}
563+
set
564+
{
565+
SetConfigurationProperty(ProjectFileConstants.WarningsNotAsErrors,value);
566+
}
567+
}
568+
557569
publicstringDocumentationFile
558570
{
559571
get

‎vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectFileConstants.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ internal static class ProjectFileConstants
130130
publicconststringNoWarn="NoWarn";
131131
publicconststringTreatWarningsAsErrors="TreatWarningsAsErrors";
132132
publicconststringWarningsAsErrors="WarningsAsErrors";
133+
publicconststringWarningsNotAsErrors="WarningsNotAsErrors";
133134
publicconststringDocumentationFile="DocumentationFile";
134135
publicconststringOtherFlags="OtherFlags";
135136
publicconststringPlatformTarget="PlatformTarget";

‎vsintegration/tests/UnitTests/Tests.Build.fs‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,21 @@ type Build() =
171171
"--highentropyva-"+ Environment.NewLine)
172172
cmd
173173

174+
[<Test>]
175+
memberpublicthis.TestWarningsNotAsErrors()=
176+
lettool=new Microsoft.FSharp.Build.Fsc()
177+
tool.WarningsNotAsErrors<-"52;109"
178+
AssertEqual"52;109" tool.WarningsNotAsErrors
179+
letcmd= tool.InternalGenerateResponseFileCommands()
180+
printfn"cmd=\"%s\"" cmd
181+
AssertEqual("--optimize+"+ Environment.NewLine+
182+
"--warnaserror-:52,109"+ Environment.NewLine+
183+
"--warnaserror:76"+ Environment.NewLine+
184+
"--fullpaths"+ Environment.NewLine+
185+
"--flaterrors"+ Environment.NewLine+
186+
"--highentropyva-"+ Environment.NewLine)
187+
cmd
188+
174189
[<Test>]
175190
memberpublicthis.TestVersionFile()=
176191
lettool=new Microsoft.FSharp.Build.Fsc()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp