Closed TimothyJCowen closed 1 year ago
This seems likely to make this analyzer quite a bit more expensive.
What benefit are we looking for by blocking ~interacting with the type in any way~ holding a variable of a given interface?
The added tests only show declaring variables, could we use OperationKind.VariableDeclaration?
OperationKind.VariableDeclaration
Edit: Was the goal to block all members without having to explicitly put the attribute on each one? Because this doesn't quite achieve that if so:
[OnlyVisibileToType( typeof( AllowedCaller ) )] public interface IRestrictedInterface { public void NotExplicitlyRestrictedMethod(); } public static class AllowedCaller { public static IRestrictedInterface Prop { get; } = ...; } public static class BlockedCaller { public static void Foo() { // Allowed AllowedCalled.Prop.NotExplicitlyRestrictedMethod(); } }
This seems likely to make this analyzer quite a bit more expensive.
What benefit are we looking for by blocking ~interacting with the type in any way~ holding a variable of a given interface?
The added tests only show declaring variables, could we use
OperationKind.VariableDeclaration
?Edit: Was the goal to block all members without having to explicitly put the attribute on each one? Because this doesn't quite achieve that if so: