-
Notifications
You must be signed in to change notification settings - Fork 684
Use pattern matching to check and perform type conversion #572
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
Conversation
SubclassMapping subclassMapping; | ||
var tempSubClassMap = mapping as SubclassMapping; | ||
if(!tempIsNull && tempMapping.IsUnionSubclass || tempSubClassMap != null && tempSubClassMap.SubclassType == SubclassType.UnionSubclass) | ||
if(!tempIsNull && tempMapping.IsUnionSubclass || mapping is SubclassMapping tempSubClassMap&& tempSubClassMap.SubclassType == SubclassType.UnionSubclass) |
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.
@pawan-deepsource this is failing with:
C:\projects\fluent-nhibernate\src\FluentNHibernate\Automapping\AutoMapper.cs(86,45): error CS0165: Use of unassigned local variable 'tempSubClassMap' [C:\projects\fluent-nhibernate\src\FluentNHibernate\FluentNHibernate.csproj]
C:\projects\fluent-nhibernate\src\FluentNHibernate\Automapping\AutoMapper.cs(86,45): error CS0165: Use of unassigned local variable 'tempSubClassMap' [C:\projects\fluent-nhibernate\src\FluentNHibernate\FluentNHibernate.csproj]
C:\projects\fluent-nhibernate\src\FluentNHibernate\Automapping\AutoMapper.cs(86,45): error CS0165: Use of unassigned local variable 'tempSubClassMap' [C:\projects\fluent-nhibernate\src\FluentNHibernate\FluentNHibernate.csproj]
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.
(in a next condition)
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 case is actually a false positive since there's a reference to tempSubClassMap
after the cast on L86. Autofix wouldn't have failed if the check hadn't fired in the first place. IMO, it was the check that misled Autofix and that's where the problem is. Tracking it internally.
Edit: Will also ensure that the whitespace and formatting is preserved.
No description provided.