using System;
_ = new Inaccessible() is [..var x];
public struct Inaccessible
{
public int Length => 42;
// this[Index] is missing
// this[Range] is not accessible
private Inaccessible this[Range r] => default;
}
Expected Behavior: two errors: one refers to the lack of this[Index] and the other says this[Range] is inaccessible.
e.g. something like this, though I'm not sure the first error is clear enough:
error CS0021: Cannot apply indexing with [] to an expression of type 'Inaccessible'
error CS0122: 'Inaccessible.this[Range]' is inaccessible due to its protection level
Actual Behavior: both error messages refer to this[Range]
error CS0122: 'Inaccessible.this[Range]' is inaccessible due to its protection level
error CS0122: 'Inaccessible.this[Range]' is inaccessible due to its protection level
Version Used: main (27 Jan 2022, https://github.com/dotnet/roslyn/commit/3b32fc36ec4c2a81457d90f965c89c5b6fc37082)
Steps to Reproduce:
Expected Behavior: two errors: one refers to the lack of
this[Index]
and the other saysthis[Range]
is inaccessible. e.g. something like this, though I'm not sure the first error is clear enough:Actual Behavior: both error messages refer to
this[Range]
https://sharplab.io/#v2:EYLgtghglgdgNAExAagD4AEBMBGAsAKAIH0ACAXhJgFMB3EgSRggGNmqBndqYAGyoAoAlCSjsSAbQB0kgG4QATiQAeAXQDcBAugDMJdgBd5AV2b6GTVhy68qBAN4ESTkjpEwzAGSowA5voAW5AB8JAAsmBr4ziQADvJQcvpU5ixsnNx8JAGi4gBKEL7J8irBJAhUAGYQRjz6kQC+QA==