-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Remove scope variance exceptions #76296
Remove scope variance exceptions #76296
Conversation
493ac3a
to
f0d3f46
Compare
@@ -118,3 +118,22 @@ class C | |||
} | |||
``` | |||
|
|||
## Variance of `scoped` and `[UnscopedRef]` is more strict |
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.
Note: I found these breaks when building the BCL with this change: dotnet/runtime@fae33d2e25a
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.
@stephentoub FYI
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.
I much prefer the consistency here, thanks!
// We have removed exceptions to the scoped mismatch error reporting, but to avoid breaks | ||
// we report the new scenarios (previously exempted) as warnings in C# 12 and earlier. | ||
// https://github.com/dotnet/roslyn/issues/76100 | ||
(overrideMethod.DeclaringCompilation.LanguageVersion > LanguageVersion.CSharp12 || usedToBeReported(baseMethod)); |
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.
Downgraded the new errors to warnings in C# 12 and lower to lessen the break per offline discussion with Jared. (We think breaking in C# 13 is fine since it's new.)
@cston @dotnet/roslyn-compiler for a second review, thanks |
This reverts commit b86d831.
This reverts commit b86d831.
Fixes #76100.
Alternative to #76261.
Speclet update: dotnet/csharplang#8777