Unnecessary Argument Checks?

Topics: APIs, General
Jun 5, 2014 at 5:38 AM
Edited Jun 5, 2014 at 5:43 AM
I've been reviewing Roslyn using the source viewer and noticed some occasions where an argument was cast to the same type it was declared as, then a check was made to see if the cast failed.

For example:
(Codeplex doesn't seem to like me linking directly to the line number...)
Line 1145 of:

Should this instead be cast to CSharpSemanticModel? If so, I'd be happy to submit a pull request.

Jun 5, 2014 at 2:45 PM
Yes, it looks like it - probably got missed when we unified on the common symbol model.

(BTW - the line numbers in the source index are links too: http://source.roslyn.codeplex.com/#Microsoft.CodeAnalysis.CSharp/Symbols/Symbol.cs#1145)
Marked as answer by TomasMatousek on 7/12/2014 at 9:56 PM