Improve LangVersion diagnostic for target typed conditional#54797
Merged
RikkiGibson merged 2 commits intodotnet:mainfrom Jul 14, 2021
Merged
Improve LangVersion diagnostic for target typed conditional#54797RikkiGibson merged 2 commits intodotnet:mainfrom
RikkiGibson merged 2 commits intodotnet:mainfrom
Conversation
333fred
approved these changes
Jul 13, 2021
cston
approved these changes
Jul 13, 2021
BillWagner
approved these changes
Jul 13, 2021
Member
BillWagner
left a comment
There was a problem hiding this comment.
I like the message @RikkiGibson It guides a developer to the potential fixes when they can upgrade, or must fix the code as is.
Member
Author
|
Great, thanks! |
Youssef1313
reviewed
Jul 13, 2021
| "CS8904", // error CS8904: Invalid variance: The type parameter 'T1' must be contravariantly valid on 'I2<T1, T2>.M1(T1)' unless language version 'preview' or greater is used. 'T1' is covariant. | ||
| "CS8912", // error CS8912: Inheriting from a record with a sealed 'Object.ToString' is not supported in C# {0}. Please use language version '{1}' or greater. | ||
| "CS8704", // error CS8704: 'Test1' does not implement interface member 'I1.M1()'. 'Test1.M1()' cannot implicitly implement a non-public member in C# 9.0. Please use language version 'preview' or greater. | ||
| "CS8957", // error CS8957: Conditional expression is not valid in language version '8.0' because a common type was not found between 'int' and '<null>'. To use a target-typed conversion, upgrade to language version '9.0' or greater. |
Member
There was a problem hiding this comment.
Consider adding a test for the codefix. Just saw it. Sorry!
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.
Closes #54793
@adegeo @BillWagner let me know if you have any feedback about the wording of the diagnostic (see the changed tests for examples).