Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Implement correct string comparisons for VB #309
String comparison behaviour for converted VB -> C# code does not match VB's behaviour.
Added a special case for string equality. Added a special case to that to produce
In that branch I was trying to handle a bunch of cases without calling VB's method. Since string comparison is such a common thing I thought it'd be good to try. But I didn't quite get around to finishing it.
I've rebased and pushed fixed the test case.
I think your branch handles more cases of implicit conversions, which this doesn't.
Unfortunately I don't think we can do much more than this PR does, in terms of not calling the method - in general it's impossible to know if a variable will be null at runtime (at least until we have non-nullable types). Without that knowledge, we have to call the method (or effectively duplicate the logic). I can think of two additional cases where we could handle this differently:
I'll add some code to handle the first case.