Repository: dotnet/runtime
File: src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MethodParametersDataFlow.cs (C#)

Code before:
                // Mismatch in implementation
                [ExpectedWarning("IL2067", "left", nameof(DataFlowTypeExtensions.RequiresPublicMethods))]
                [ExpectedWarning("IL2067", "right", nameof(DataFlowTypeExtensions.RequiresPublicMethods))]
                public static OperatorType operator -(
                    [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] OperatorType left,
                    [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] OperatorType right)
                {
                    left.RequiresPublicMethods();
                    right.RequiresPublicMethods();
                    return new OperatorType();
                }
            }
        }

        [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
        private static Type GetTypeWithPublicConstructors()
        {
            return null;
        }

        private static Type GetUnknownType()
        {
            return null;
        }

        // https://github.com/dotnet/runtime/issues/111651
        class NamedArgumentsWithAnnotations
        {
            record BaseRecord(
                string? OptionalParameter = null,
                [property: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
                [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
                Type? AnnotatedParameter = null,
                object? UnannotatedParameter = null
            );

            // This should not warn about 'UnannotatedParameter'
            record DerivedRecord(
                [param: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.PublicConstructors)]
                Type? AnnotatedParameter = default,
                object? UnannotatedParameter = default
            ) : BaseRecord(
                AnnotatedParameter: AnnotatedParameter,
                UnannotatedParameter: UnannotatedParameter
            );

            static void RequiresPublicConstructors(
                string? optionalParameter = null,
                [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
                Type? annotatedParameter = null,
                object? unannotatedParameter = null)

Review comment (suggestion):
```suggestion
        // https://github.com/dotnet/runtime/issues/121629
```

Code after:
                // Mismatch in implementation
                [ExpectedWarning("IL2067", "left", nameof(DataFlowTypeExtensions.RequiresPublicMethods))]
                [ExpectedWarning("IL2067", "right", nameof(DataFlowTypeExtensions.RequiresPublicMethods))]
                public static OperatorType operator -(
                    [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] OperatorType left,
                    [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] OperatorType right)
                {
                    left.RequiresPublicMethods();
                    right.RequiresPublicMethods();
                    return new OperatorType();
                }
            }
        }

        [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
        private static Type GetTypeWithPublicConstructors()
        {
            return null;
        }

        private static Type GetUnknownType()
        {
            return null;
        }

        // https://github.com/dotnet/runtime/issues/121629
        class NamedArgumentsWithAnnotations
        {
            record BaseRecord(
                string? OptionalParameter = null,
                [property: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
                [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
                Type? AnnotatedParameter = null,
                object? UnannotatedParameter = null
            );

            // This should not warn about 'UnannotatedParameter'
            record DerivedRecord(
                [param: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor | DynamicallyAccessedMemberTypes.PublicConstructors)]
                Type? AnnotatedParameter = default,
                object? UnannotatedParameter = default
            ) : BaseRecord(
                AnnotatedParameter: AnnotatedParameter,
                UnannotatedParameter: UnannotatedParameter
            );

            static void RequiresPublicConstructors(
                string? optionalParameter = null,
                [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
                Type? annotatedParameter = null,
                object? unannotatedParameter = null)