Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static void WithLocalFunctionInner()
}

// Analyzer doesn't implement constant propagation and branch removal, so it reaches this code
[ExpectedWarning("IL2026", Tool.Analyzer, "")]
[ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not implement constant prop and branch removal")]
void LocalWithWarning()
{
// No warning
Expand All @@ -63,7 +63,7 @@ public static void WithLocalFunction()
}

// Analyzer doesn't implement constant propagation and branch removal, so it reaches this code
[ExpectedWarning("IL2026", Tool.Analyzer, "")]
[ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not implement constant prop and branch removal")]
void LocalWithWarning()
{
Requires();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class GenericTypeWithRequires<[DynamicallyAccessedMembers(DynamicallyAccessedMem
{
}

[ExpectedWarning("IL3050", Tool.Analyzer, "")]
[ExpectedWarning("IL3050", Tool.Analyzer, "Analyzer-specific behavior")]
[ExpectedWarning("IL2091", "'T'")]
public static void Test<T>()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ public static void Test()

class InvalidFeatureGuards
{
[ExpectedWarning("IL4001", Tool.Analyzer, "")]
[ExpectedWarning("IL4001", Tool.Analyzer, "Analyzer limitation with feature guards")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static int NonBooleanProperty => 0;

Expand All @@ -475,7 +475,7 @@ static void TestNonBooleanProperty()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4001", Tool.Analyzer, "")]
[ExpectedWarning("IL4001", Tool.Analyzer, "Analyzer limitation with feature guards")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
bool NonStaticProperty => true;

Expand All @@ -497,7 +497,7 @@ static void TestSetOnlyProperty()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4001", Tool.Analyzer, "")]
[ExpectedWarning("IL4001", Tool.Analyzer, "Analyzer limitation with feature guards")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool GetAndSetProperty { get => true; set => throw null; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,12 +708,12 @@ public static void StaticPartialInstantiation()
[nameof(TOuter),
"Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.TypeWithInstantiatedGenericMethodViaGenericParameter<TOuter>",
"TMethods",
"Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.BaseTypeWithGenericMethod.StaticRequiresMultipleGenericParams<TFields, TMethods>()"], Tool.Analyzer, "")]
"Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.BaseTypeWithGenericMethod.StaticRequiresMultipleGenericParams<TFields, TMethods>()"], Tool.Analyzer, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091",
["'TOuter'",
"Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.TypeWithInstantiatedGenericMethodViaGenericParameter",
"'TMethods'",
"Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.BaseTypeWithGenericMethod.StaticRequiresMultipleGenericParams"], Tool.Trimmer | Tool.NativeAot, "")]
"Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.BaseTypeWithGenericMethod.StaticRequiresMultipleGenericParams"], Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
public static void StaticPartialInstantiationUnrecognized()
{
StaticRequiresMultipleGenericParams<TestType, TOuter>();
Expand Down Expand Up @@ -840,13 +840,13 @@ static void TestNoWarningsInRUCType<T, U>()
rucType.VirtualMethodRequiresPublicMethods<T>();
}

[ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void TestInstanceMethodOnValueType<T>()
{
default(RequiresParameterlessCtor<T>).Do();
}

[ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void TestValueTypeBox<T>()
{
if (default(RequiresParameterlessCtor<T>) is IRequireParameterlessCtor<T> i)
Expand All @@ -855,15 +855,15 @@ static void TestValueTypeBox<T>()
}
}

[ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void TestMkrefAny<T>()
{
RequiresParameterlessCtor<T> val = default;
TypedReference tr = __makeref(val);
// This is a potential box operation, e.g. TypedReference.ToObject(tr);
}

[ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void TestInArray<T>()
{
var arr = new RequiresParameterlessCtor<T>[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ interface IWithTwo<

static void MethodWithSpecificType(TypeWithPublicMethods<TestType> one, IWithTwo<TestType, TestType> two) { }

[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")]
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")]
static void MethodWithOneMismatch<TUnknown>(TypeWithPublicMethods<TUnknown> one) { }

[ExpectedWarning("IL2091", nameof(IWithTwo<TestType, TestType>), Tool.NativeAot | Tool.Trimmer, "")]
[ExpectedWarning("IL2091", nameof(TypeWithPublicMethods<TestType>), Tool.NativeAot | Tool.Trimmer, "")]
[ExpectedWarning("IL2091", nameof(IWithTwo<TestType, TestType>), Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091", nameof(TypeWithPublicMethods<TestType>), Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")]
static void MethodWithTwoMismatches<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods>
Expand All @@ -252,19 +252,19 @@ static void MethodWithTwoMismatches<

static TypeWithPublicMethods<TPublicMethods> MethodWithMatchingReturn<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods>() => null;

[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")]
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")]
static TypeWithPublicMethods<TUnknown> MethodWithOneMismatchReturn<TUnknown>() => null;

[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")]
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")]
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")]
static IWithTwo<TPublicFields, TPublicMethods> MethodWithTwoMismatchesInReturn<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods>
() => null;

class ConstructorWithOneMatchAndOneMismatch<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TMethods>
{
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")]
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")]
public ConstructorWithOneMatchAndOneMismatch(IWithTwo<TMethods, TMethods> two) { }
}

Expand Down Expand Up @@ -367,19 +367,19 @@ class OneMatchingAnnotation<[DynamicallyAccessedMembers(DynamicallyAccessedMembe

class MultipleReferencesToTheSameType<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods, TUnknown>
{
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")]
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")]
static TypeWithPublicMethods<TUnknown> _field1;
static TypeWithPublicMethods<TPublicMethods> _field2;
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")]
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")]
static TypeWithPublicMethods<TUnknown> _field3;
}

class TwoMismatchesInOne<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields>
{
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")]
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")]
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")]
static IWithTwo<TPublicFields, TPublicMethods> _field;
}

Expand Down Expand Up @@ -545,8 +545,8 @@ static void SpecificType()
}

// Analyzer doesn't warn on typeof
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void MultipleReferencesToTheSameType<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods,
TUnknown>()
Expand All @@ -557,8 +557,8 @@ static void MultipleReferencesToTheSameType<
}

// Analyzer doesn't warn on typeof
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void TwoMismatchesInOneStatement<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods>
Expand Down Expand Up @@ -911,9 +911,9 @@ static void SpecificType()
// ldtoken owningtype
// In order to call the right Expression APIs.
[ExpectedWarning("IL2091")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void MultipleReferencesToTheSameMethod<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods,
TUnknown>()
Expand All @@ -928,9 +928,9 @@ static void MultipleReferencesToTheSameMethod<
// ldtoken owningtype
// In order to call the right Expression APIs.
[ExpectedWarning("IL2091")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void TwoMismatchesInOneStatement<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods>
Expand Down Expand Up @@ -966,8 +966,8 @@ static void SpecificType()
// ldtoken field
// ldtoken owningtype
// In order to call the right Expression APIs.
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void MultipleReferencesToTheSameField<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods,
TUnknown>()
Expand All @@ -983,8 +983,8 @@ static void MultipleReferencesToTheSameField<
// ldtoken field
// ldtoken owningtype
// In order to call the right Expression APIs.
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void TwoMismatchesInOneStatement<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods>
Expand Down Expand Up @@ -1020,8 +1020,8 @@ static void SpecificType()
// ldtoken method (getter)
// ldtoken owningtype
// In order to call the right Expression APIs.
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void MultipleReferencesToTheSameProperty<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods,
TUnknown>()
Expand All @@ -1037,8 +1037,8 @@ static void MultipleReferencesToTheSameProperty<
// ldtoken method (getter)
// ldtoken owningtype
// In order to call the right Expression APIs.
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
[ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")]
static void TwoMismatchesInOneStatement<
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields,
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods>
Expand Down
Loading