-
Notifications
You must be signed in to change notification settings - Fork 93
Closed
Labels
type: bugThe Standard does not describe the language as intended or implementedThe Standard does not describe the language as intended or implemented
Description
We have the following example in 18.4.6 (which isn't tested as it's marked for "needs review"):
interface IList
{
int Count { get; set; }
}
interface ICounter
{
void Count(int i);
}
interface IListCounter : IList, ICounter {}
class C
{
void Test(IListCounter x)
{
x.Count(1); // Error
x.Count = 1; // Error: cannot assign to a method group
((IList)x).Count = 1; // Ok, invokes IList.Count.set
((ICounter)x).Count(1); // Ok, invokes ICounter.Count
}
}
With text:
In the following code [...] the first two statements cause compile-time errors because the member lookup (§12.5) of
Count
inIListCounter
is ambiguous.
However, the first of these statements works when running the example tester. It's only the second which fails (CS1656: Cannot assign to 'Count' because it is a 'method group').
Has interface member lookup changed in a way that has made the first statement become valid, or has the spec always just been wrong?
Metadata
Metadata
Assignees
Labels
type: bugThe Standard does not describe the language as intended or implementedThe Standard does not describe the language as intended or implemented