-
Notifications
You must be signed in to change notification settings - Fork 832
Closed
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone
Description
Repro steps
Provide the steps required to reproduce the problem:
- Define a type with an abstract member having two parameters with the same name.
- It compiles, generating unutterable names for all repeated parameter names after the first.
Examples
type I =
// Tupled.
abstract M : i:int * i:int -> int
// Curried.
abstract N : i:int -> i:int -> int
// More than two.
abstract O : i:int * i: int * i:int -> int
// Multiple distinct names repeated.
abstract P : i:int * j:int * i:int * j:int -> intgenerates (SharpLab)
[Serializable]
[CompilationMapping(SourceConstructFlags.ObjectType)]
public interface I
{
override int M(int i, int i@3);
[CompilationArgumentCounts(new int[] { 1, 1 })]
override int N(int i, int i@5-1);
override int O(int i, int i@7-2, int i@7-3);
override int P(int i, int j, int i@9-4, int j@9);
}Expected behavior
A compiler error disallowing multiple parameters with the same name in abstract methods.
Actual behavior
The code compiles, but the names of all repeated parameter names are unutterable.
Known workarounds
It is still possible to implement an abstract method so defined, although it is not possible to make the concrete implementation's parameters' names match those of the abstract method being overridden.
Related information
- .NET SDK 6.0.300.
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Type
Projects
Status
Done