dotnet/roslyn

Missing CS8970 when applying attribute alias with unsupported type substitution

クローズ

#58,836 opened on 2022/01/13

 (2 件のコメント) (1 件のリアクション) (1 人の担当者)C# (4,257 件のフォーク)batch import
Area-CompilersBughelp wanted

Repository metrics

Stars
 (20,414 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

Version Used: sharplab.io main 6 Jan 2022

Steps to Reproduce:

Compile the following code:

using System;

using SomeDynamicAlias = Some<dynamic>;
using SomeNamedTupleAlias = Some<(int X, int Y)>;

[SomeDynamicAlias]     // no error but should be
[SomeNamedTupleAlias]  // no error but should be
[Some<dynamic>]        // error
[Some<(int X, int Y)>] // error
public class C
{    
}

[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
class Some<T> : Attribute
{  
}

Expected Behavior: Error CS8970 on every attribute application including aliases.

Actual Behavior: No CS8970 when applying alias with unsupported type substitution.

コントリビューターガイド