- Notifications
You must be signed in to change notification settings - Fork4.2k
Raise the default warning level in tests#47077
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
af25f477faffaed77232ddd454c4a80d03eceed1f8afc64bef0950fcf2114f254b0c34368a08f49709b9d773bedbc9d1c039c9106f5a47702ce9c1eef5af4b4a422d8248daa899783b0a94ec22d469c4f5ea9ff755141e68704b06df16740a56b3e20b5bac742af28b073cabe90a91ea2a0d753157b655dc816b2ff7d2ec80ada6c133d3937815651d9f2349b487ff879a7027fbbf3c7File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
…needed
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -43,7 +43,7 @@ struct S | ||
| // if (s != null) { } | ||
| Diagnostic(ErrorCode.WRN_NubExprIsConstBool2, "s != null").WithArguments("true", "S", "S?").WithLocation(7, 13) | ||
| }; | ||
| CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics(); | ||
| CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(3)).VerifyDiagnostics(); | ||
| CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(4)).VerifyDiagnostics(); | ||
| CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics(whenWave5); | ||
MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Do you want to remove the explicit WithWarningLevel here? Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Let's leave it as-is, especially since we don't use 5 as our default warning level in tests, we use MaxWarningLevel. | ||
| @@ -73,7 +73,7 @@ static class SC { } | ||
| // _ = o as SC; | ||
| Diagnostic(ErrorCode.WRN_StaticInAsOrIs, "o as SC").WithArguments("SC").WithLocation(7, 17) | ||
| }; | ||
| CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics(); | ||
| CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(4)).VerifyDiagnostics(); | ||
| CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics(whenWave5); | ||
| } | ||
| @@ -112,7 +112,7 @@ static void M2() | ||
| // var i = ()=>{} + x; | ||
| Diagnostic(ErrorCode.WRN_PrecedenceInversion, "+").WithArguments("+").WithLocation(20, 24) | ||
| }; | ||
| CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics(); | ||
| CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(4)).VerifyDiagnostics(); | ||
| CreateCompilation(source, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics(whenWave5); | ||
| } | ||
| @@ -137,7 +137,7 @@ public Program(int dummy) | ||
| { | ||
| } | ||
| }"; | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( | ||
| ); | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( | ||
| // (4,12): warning CS8822: Auto-implemented property 'Program.Property' must be fully assigned before control is returned to the caller. | ||
| @@ -166,7 +166,7 @@ public Program(int dummy) | ||
| { | ||
| } | ||
| }"; | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( | ||
| ); | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( | ||
| // (4,12): warning CS8823: Field 'Program.Field' must be fully assigned before control is returned to the caller | ||
| @@ -194,7 +194,7 @@ void M(out Struct param) | ||
| { | ||
| } | ||
| }"; | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( | ||
| ); | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( | ||
| // (3,10): warning CS8824: The out parameter 'param' must be assigned to before control leaves the current method | ||
| @@ -225,7 +225,7 @@ public struct Struct | ||
| Property = default; | ||
| } | ||
| }"; | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( | ||
| ); | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( | ||
| // (6,21): warning CS8825: Use of possibly unassigned auto-implemented property 'Property' | ||
| @@ -256,7 +256,7 @@ public struct Struct | ||
| Field = default; | ||
| } | ||
| }"; | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( | ||
| ); | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( | ||
| // (6,21): warning CS8826: Use of possibly unassigned field 'Field' | ||
| @@ -287,7 +287,7 @@ public struct Struct | ||
| this.Field = default; | ||
| } | ||
| }"; | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( | ||
| ); | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( | ||
| // (6,22): warning CS8827: The 'this' object cannot be used before all of its fields have been assigned | ||
| @@ -317,7 +317,7 @@ public static void M(out Struct r1) | ||
| r1 = default; | ||
| } | ||
| }"; | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( | ||
| ); | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( | ||
| // (5,18): warning CS8828: Use of unassigned out parameter 'r1' | ||
| @@ -347,7 +347,7 @@ public static void Main() | ||
| var r2 = r1; | ||
| } | ||
| }"; | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(CodeAnalysis.Diagnostic.DefaultWarningLevel)).VerifyDiagnostics( | ||
| ); | ||
| CreateCompilation(source2, references: new MetadataReference[] { moduleReference }, options: TestOptions.ReleaseDll.WithWarningLevel(5)).VerifyDiagnostics( | ||
| // (6,18): warning CS8829: Use of unassigned local variable 'r1' | ||