dotnet/roslyn

Assert failures handling DynamicObjectCreationExpression in GetValEscape() and CheckValEscape()

Open

#67,518 创建于 2023年3月28日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)C# (4,257 fork)batch import
Area-CompilersBughelp wanted

仓库指标

Star
 (20,414 star)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

Version Used: release/dev17.4: https://github.com/dotnet/roslyn/commit/528676cdbf0bfcfdb9372dc57a047dd0edc6d4db main: https://github.com/dotnet/roslyn/commit/3dee0a96cd8b5478390c47ddb0545875bf6b4c18

Steps to Reproduce:

Compile with DEBUG build:

static class Program
{
    static void Main()
    {
        dynamic d = 0;
        R x = new R(d);
        R y;
        y = new R(default(R), d);
    }
}

readonly ref struct R
{
    public R(int i) { }
    public R(R r, int i) { }
}

Expected Behavior: (8,19): error CS1978: Cannot use an expression of type 'R' as an argument to a dynamically dispatched operation.

Actual Behavior: Assert failures with message "DynamicObjectCreationExpression expression of R type" in GetValEscape() and CheckValEscape().

(8,19): error CS1978: Cannot use an expression of type 'R' as an argument to a dynamically dispatched operation. (8,13): error CS8751: Internal error in the C# compiler.

贡献者指南