Comments (1)
Closing out. The compiler doesn't track the null relationship through arithmetic expressions (like (ids?.Count ?? 0)
and then teh ==0
).
You can write this as:
if (ids is null || ids.Count == 0)
{
return;
}
or
if (ids is not { Count: > 0 })
return;
It would be much nicer if the compiler could detect that the variable cannot be null in this case.
We've looked at this sort of relationship before and decided the large increase in analysis complexity is not worth it, given hte simple and idiomatic transforms available.
from roslyn.
Related Issues (20)
- Obsoleted parameterless constructors can be used as generic arguments with no warnings HOT 1
- Interface implementation option not available for classes
- Auto formatting C# code with list assignments does not indent correctly
- Expose Hot Reload functionality for third-party tools
- Remove `MetadataHelpers.GenericParameterAttributesAllowByRefLike` in favor of `GenericParameterAttributes.AllowByRefLike` HOT 1
- A test gap in `GetValEscape` method
- A test gap in `CheckInvocationArgMixing` method HOT 1
- A test gap in `VisitDeclarationPattern` method
- New syntax related APIs to support "Ref Struct Interfaces" feature HOT 1
- Enable `RefFieldTypeAllowsRefLike` test once we get support for 'byreflike' in IL
- Consider testing ERR_ScopedMismatchInParameterOfPartial and ERR_ScopedMismatchInParameterOfTarget when ref like type parameters are involved
- Consider testing scenario similar to one in `MissingScopedInOverride_01`, but with implicitly scoped parameter
- A misleading warning is reported for an inline array type with ref like type parameter as an element type
- Consider testing scenario similar to the one in `UnscopedRef_02` without params
- Follow up on used assemblies validation failure for `AnonymousTypeMember_02` unit-test
- Consider adjusting wording for `ErrorCode.ERR_NoConvToIDisp`
- Assert fires in `EnsureMetadataVirtual` HOT 1
- [Automated] PRs inserted in VS build main-34917.78
- Expose `SeparatedSyntaxList<T>.GetWithSeparators()` through interface HOT 9
- "Add await" should be upgraded to a codefix in presence of CS4014
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from roslyn.