Do not bail generating base type initializer in the presence of use site warnings#76347
Merged
333fred merged 3 commits intodotnet:mainfrom Dec 11, 2024
Merged
Do not bail generating base type initializer in the presence of use site warnings#76347333fred merged 3 commits intodotnet:mainfrom
333fred merged 3 commits intodotnet:mainfrom
Conversation
…ite warnings We were returning early from generating a call to the base record copy constructor initializer if use site diagnostics reported any kind of diagnostic, including warnings. This isn't good in general, but is particularly bad for warnings like CS1701, which are typically suppressed by the SDK and results in what seems like a completely clean csc invocation skipping calling the base constructor. Fixes dotnet#72357.
ae3f955 to
64bda64
Compare
Member
Author
|
@dotnet/roslyn-compiler for reviews |
333fred
commented
Dec 10, 2024
| } | ||
|
|
||
| internal static bool ReportConstructorUseSiteDiagnostics(Location errorLocation, BindingDiagnosticBag diagnostics, bool suppressUnsupportedRequiredMembersError, in CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) | ||
| internal static void ReportConstructorUseSiteDiagnostics(Location errorLocation, BindingDiagnosticBag diagnostics, bool suppressUnsupportedRequiredMembersError, in CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) |
Member
Author
There was a problem hiding this comment.
There are lots of uses of this method, but this was the only one that did something conditional. That seemed like a bad thing to keep around, so I just made the method return void instead to prevent something like this from happening again.
333fred
commented
Dec 10, 2024
5c11508 to
64bda64
Compare
AlekseyTs
reviewed
Dec 10, 2024
Contributor
|
Done with review pass (commit 2) |
AlekseyTs
reviewed
Dec 10, 2024
| public record DerivedRecord : BaseRecord; | ||
| """, assemblyName: "Derived", references: [comp1.EmitToImageReference()], targetFramework: TargetFramework.Net80); | ||
|
|
||
| var verifier = CompileAndVerify(comp2, expectedOutput: ExecutionConditionUtil.IsCoreClr ? "False" : null, verify: Verification.FailsPEVerify); |
Contributor
Member
Author
There was a problem hiding this comment.
Since this is specifically .NET 8, I don't think all mono environments would work, so I only did CoreClr.
This was referenced Dec 13, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We were returning early from generating a call to the base record copy constructor initializer if use site diagnostics reported any kind of diagnostic, including warnings. This isn't good in general, but is particularly bad for warnings like CS1701, which are typically suppressed by the SDK and results in what seems like a completely clean csc invocation skipping calling the base constructor. Fixes #72357.