roslyn
roslyn copied to clipboard
Missing CS8970 when applying attribute alias with unsupported type substitution
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.
💭 There should be an error on the declaration of the alias at least (currently not the case). Not sure how much added value there is to report again on usage sites after that.
@RikkiGibson for triage. Thanks