-
Notifications
You must be signed in to change notification settings - Fork 4k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not resolve diagnostics early during attribute binding #71140
Changes from 9 commits
7cd01d6
36e120f
94b0d76
3c7fa2b
9db1515
90b2784
47f13c0
5fb44f3
92a0a6d
74f903b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1728,9 +1728,12 @@ private BoundExpression ReplaceTypeOrValueReceiver(BoundExpression receiver, boo | |
|
||
foreach (Diagnostic d in typeOrValue.Data.ValueDiagnostics.Diagnostics) | ||
{ | ||
if (d.Code == (int)ErrorCode.WRN_PrimaryConstructorParameterIsShadowedAndNotPassedToBase && | ||
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.
|
||
// Avoid forcing resolution of lazy diagnostics to avoid cycles. | ||
var code = d is DiagnosticWithInfo { HasLazyInfo: true, LazyInfo.Code: var lazyCode } ? lazyCode : d.Code; | ||
if (code == (int)ErrorCode.WRN_PrimaryConstructorParameterIsShadowedAndNotPassedToBase && | ||
333fred marked this conversation as resolved.
Show resolved
Hide resolved
|
||
!(d.Arguments is [ParameterSymbol shadowedParameter] && shadowedParameter.Type.Equals(typeOrValue.Data.ValueExpression.Type, TypeCompareKind.AllIgnoreOptions))) // If the type and the name match, we would resolve to the same type rather than a value at the end. | ||
{ | ||
Debug.Assert(d is not DiagnosticWithInfo { HasLazyInfo: true }, "Adjust the Arguments access to handle lazy diagnostics to avoid cycles."); | ||
diagnostics.Add(d); | ||
} | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was recursion source 1.
ToReadOnlyAndFree
forces resolution of lazy diagnostics. We would attempt to resolve whether to report obsolete on the value, which then forced us to bind assembly attributes, bringing us right back here.