dotnet/roslyn

Missing CS8970 when applying attribute alias with unsupported type substitution

Chiusa

#58.836 aperta il 13 gen 2022

 (2 commenti) (1 reazione) (1 assegnatario)C# (4257 fork)batch import
Area-CompilersBughelp wanted

Metriche repository

Star
 (20.414 stelle)
Metriche merge PR
 (Merge medio 6g 17h) (256 PR mergiate in 30 g)

Descrizione

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.

Guida contributor