rsdn/nemerle — Issue #163: <<(ulong, int) should return ulong instead of int
Author: zyhong
Created: 2011-10-29 02:43:42+00:00
State: open

from MS: http://msdn.microsoft.com/en-us/library/aa691377(v=vs.71).aspx
<< is overloaded like these:

int operator <<(int x, int count);
uint operator <<(uint x, int count);
long operator <<(long x, int count);
ulong operator <<(ulong x, int count);

the following code:

using System;
public class T
{
void M()
{
ulong l = 0;
int i = 1;
l |= 2UL << i;
}
}

produce this error: (it seems 2UL << i return int instead of ulong)

...\C.cs(8,9): error : each overload has an error during call:
...\C.cs(8,9): error : overload #1, "method System.UInt64.op_BitwiseOr(left : ulong, right : ulong) : ulong" fail because:
...\C.cs(8,9): error : in argument #2, needed a ulong, got int: System.Int32 is not a subtype of System.UInt64 [simple require]
...\C.cs(8,9): error : overload #2, "method System.Int32.op_BitwiseOr(left : int, right : int) : int" fail because:
...\C.cs(8,9): error : in argument #1, needed a int, got ulong: System.UInt64 is not a subtype of System.Int32 [simple require]