dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.78k stars 4k forks source link

Microsoft.DotNet.GenAPI.Tests/CSharpFileBuilderTests.cs in SDK repo test failures #74109

Open MiYanni opened 1 month ago

MiYanni commented 1 month ago

Summary

In dotnet/sdk, there were 2 tests marked against this original issue. That issue has been closed, but unskipping the tests still results in failure. This is to investigate those test failures.

TestInterfaceWithOperatorGeneration

Fails with:

    Expected:
    namespace A
    {
        public partial interface IntType
        {
            public static IntType operator +(IntType left, IntType right) => left + right;
        }
    }
    Resulted:
    namespace A
    {
        public partial interface IntType
        {
            static public IntType operator +(IntType left, IntType right) { throw null; };
        }
    }

TestInterfaceWithCheckedOperatorGeneration

Fails with:

    Expected:
    namespace A
    {
        public interface IAdditionOperators<TSelf, TOther, TResult>
            where TSelf : IAdditionOperators<TSelf, TOther, TResult>?
        {
            static abstract TResult operator +(TSelf left, TOther right);
            static virtual TResult operator checked +(TSelf left, TOther right) { throw null; }
        }
    }
    Resulted:
    namespace A
    {
        public partial interface IAdditionOperators<TSelf, TOther, TResult>
            where TSelf : IAdditionOperators<TSelf, TOther, TResult>?
        {
            static public abstract TResult operator +(TSelf left, TOther right) { throw null; };
            static public virtual TResult operator checked +(TSelf left, TOther right) { throw null; };
        }
    }
jaredpar commented 1 month ago

Can you expand on what you think is a bug in the compiler?

MiYanni commented 1 month ago

@jaredpar

Can you expand on what you think is a bug in the compiler?

I don't think there is a bug in the compiler. However, the tests were marked as Skip against an issue in this repo. That issue is closed and I cannot reopen it myself. So, I created this new issue in this repo to encompass these test failures and marked them as Skip against this one.

I'm doing this same process for every test skipped that I'm trying to unskip in this PR.