Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion hit in SyntheticBoundNodeFactory.Convert #61284

Closed
jcouv opened this issue May 12, 2022 · 0 comments · Fixed by #61287
Closed

Assertion hit in SyntheticBoundNodeFactory.Convert #61284

jcouv opened this issue May 12, 2022 · 0 comments · Fixed by #61287
Assignees
Labels
Area-Compilers Bug Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@jcouv
Copy link
Member

jcouv commented May 12, 2022

We can hit this assertion: Debug.Assert(useSiteInfo.Diagnostics.IsNullOrEmpty());
This is the second instance of this assertion getting hit (see issue #60060).

The following test crashes on the assertion:

        [Fact]
        public void TODO2()
        {
            string sourceRefLib = @"
public class Base { }
";

            var refLib = CreateEmptyCompilation(
                sourceRefLib,
                assemblyName: "RefLib",
                references: new[] { TestMetadata.Net20.mscorlib });

            refLib.VerifyEmitDiagnostics();

            string sourceMain = @"
public class Derived : Base { }
class C
{
    void M(Derived d)
    {
        _ = d is Base b;
    }
}
";

            var main = CreateEmptyCompilation(sourceMain, assemblyName: "Main",
                references: new MetadataReference[]
                {
                    new CSharpCompilationReference(refLib),
                    TestMetadata.Net451.mscorlib
                });

            var unifyReferenceWarning =
                // warning CS1701: Assuming assembly reference 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' used by 'RefLib' matches identity 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' of 'mscorlib', you may need to supply runtime policy
                Diagnostic(ErrorCode.WRN_UnifyReferenceMajMin).WithArguments("mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "RefLib", "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "mscorlib");

            main.VerifyEmitDiagnostics(unifyReferenceWarning, unifyReferenceWarning, unifyReferenceWarning, unifyReferenceWarning, unifyReferenceWarning, unifyReferenceWarning);
        }
SyntheticBoundNodeFactory.Convert(TypeSymbol type, BoundExpression arg) line 1306
PatternLocalRewriter.TryLowerTypeTestAndCast(BoundDagTest test, BoundDagEvaluation evaluation, BoundExpression& sideEffect, BoundExpression& testExpression) line 491
IsPatternExpressionLinearLocalRewriter.ProduceLinearTestSequence(BoundDecisionDagNode node, LabelSymbol whenTrueLabel, LabelSymbol whenFalseLabel) line 254
IsPatternExpressionLinearLocalRewriter.LowerIsPatternAsLinearTestSequence(BoundIsPatternExpression isPatternExpression, BoundDecisionDag decisionDag, LabelSymbol whenTrueLabel, LabelSymbol whenFalseLabel) line 229
LocalRewriter.VisitIsPatternExpression(BoundIsPatternExpression node) line 24
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label May 12, 2022
@jcouv jcouv self-assigned this May 13, 2022
@jcouv jcouv removed the untriaged Issues and PRs which have not yet been triaged by a lead label May 13, 2022
@jcouv jcouv added this to the 17.3 milestone May 13, 2022
sharwell added a commit to sharwell/roslyn that referenced this issue May 13, 2022
Works around assertion (see dotnet#61284).
@jcouv jcouv added Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented Bug labels May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant