2021.3 gives incorrect "suppression operator not allowed" errors
The following should be valid:
class Something<T>
where T : notnull {
void DoSomething(T t) {
if (t is null!)
return;
}
}
Rider is giving "The suppression operator is not allowed in this context." error on the ! operator. (it's not the null check but the ! (suppression/null-forgiving) operator).
The code builds fine, it's just Rider/ReSharper giving this error, I think.
I can't supress the error, but I can change it into an "expression is always true/false" warning by removing the ! and then supressing that warning.
This could be related to using C# 10 or something but I am not able to use C# 10 features (it says to change the language version to use them). And the project does build.
As an aside, it would be nice if it was easier to determine what language version (and maybe framework) was being used on the current document or project. The framework is shown when multi-targetting but not when 'single-targetting' and the version is not shown.
Please sign in to leave a comment.
Hi,
Thank you for reporting this.
I've filed an issue: https://youtrack.jetbrains.com/issue/RSRP-487408. Please follow it for further updates.
K.R.
Sofia