Annotation in Incompatible Component Type

Flags Rubberduck annotations used in a component type that is incompatible with that annotation.

Reasoning

Some annotations can only be used in a specific type of module; others cannot be used in certain types of modules.

Default severity

Warning

Inspection type

CodeQualityIssues

Examples

This example should trigger a result

MyModule (StandardModule)
'@PredeclaredId 'this annotation is illegal in a standard module Option Explicit

This example should NOT trigger a result

MyModule (ClassModule)
'@PredeclaredId 'this annotation works fine in a class module Option Explicit Public Sub DoSomething() Dim foo As Long End Sub

Rubberduck.CodeAnalysis.Inspections.Concrete.AnnotationInIncompatibleComponentTypeInspection.cs (Prerelease-v2.5.9.6289)