dotnet/roslyn

Incorrect behavior when using alias refers to namespace in using alias

Open

#1.027 geöffnet am 4. März 2015

Auf GitHub ansehen
 (17 Kommentare) (1 Reaktion) (0 zugewiesene Personen)C# (4.257 Forks)batch import
Area-CompilersBughelp wanted

Repository-Metriken

Stars
 (20.414 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)

Beschreibung

extern alias Contracts1;
extern alias Contracts2;

using alias1 = Contracts1::TestContractAssembly;
using alias2 = Contracts2::TestContractAssembly;

partial class Contract : alias1.IContract, alias2.IContract
{
    int alias1.IContract.x
    {
        get
        {
            return 1;
        }
    }
    int alias2.IContract.x
    {
        get
        {
            return 1;
        }
    }
}

Both IContract types are the same - they expose an int property "x". Roslyn incorrectly reports that IContract.x has already been implemented.

This works if you inline the using aliases.

I strongly suspect that the alias points to the merged namespace symbol, rather than to the namespace symbol contained in the assembly symbol referenced by the extern alias.

Contributor Guide