Closed danelkhen closed 9 years ago
Same happens with 'logical or' and 'bitwise or'
C# spec:
The operation
x && y
is evaluated asT.false(x) ? x : T.&(x, y)
, whereT.false(x)
is an invocation of theoperator false
declared in T , andT.&(x, y)
is an invocation of the selectedoperator &
.
NRefactory currently represents this as an OperatorResolveResult
with OperatorType
=AndAlso
and UserDefinedOperatorMethod
= the selected operator &
.
Which kind of ResolveResult
would you expect?
Intersting, I didn't know that actually. Well if this is by design and the situation is easily detectable I guess the current behavior is as good as any. Another option is to resolve / expand this result according to the spec, which means: x && y => Trinary(False(x), BitwiseAnd(x, y))
But again, this is more of an expanded resolve result, so the current behavior is fine too.
Hi, It seems like as soon as a class is overloading the '&' operator (and true and false opeartors as required), the conditional && operator is resolved as - OperatorType.AndAlso (correct), but UserDefinedOperatorMethod to op_BitwiseAnd.
Reproduction code: