Correctly detect option strict on/off when determining if cast is redundant
Fixes #3161 and Fixes #3163 User Scenario: User has code with narrowing conversion with an explicit cast. We will offer to remove the cast even though this will cause the code to not compile. Fix Description: We previously never consulted optionstrict to determine if a user-defined narrowing cast was necessary. The fix in CastAnalyzer.vb will check if the conversion is narrowing, if option strict is on, or if we generate a warning on implicit narrowing conversions. We also offer to add a cast if an implicit conversion warning is given. Testing: Added regression tests + existing tests
Showing
想要评论请 注册 或 登录