Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -38,8 +38,8 @@ static IEnumerable<int> FlowAcrossYieldReturn()
}

// Trimmer tracks all assignments of hoisted locals, so this produces warnings.
[ExpectedWarning("IL2072", nameof(GetWithPublicMethods), nameof(DataFlowTypeExtensions.RequiresPublicFields), Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)]
[ExpectedWarning("IL2072", [nameof(GetWithPublicFields), nameof(DataFlowTypeExtensions.RequiresPublicMethods)], Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)]
[UnexpectedWarning("IL2072", nameof(GetWithPublicMethods), nameof(DataFlowTypeExtensions.RequiresPublicFields), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117155", CompilerGeneratedCode = true)]
[UnexpectedWarning("IL2072", [nameof(GetWithPublicFields), nameof(DataFlowTypeExtensions.RequiresPublicMethods)], Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117155", CompilerGeneratedCode = true)]
static IEnumerable<int> NoFlowAcrossYieldReturn()
{
Type t = GetWithPublicMethods();
Expand Down Expand Up @@ -226,8 +226,8 @@ static async void FlowAcrossAwait()
}

// Trimmer tracks all assignments of hoisted locals, so this produces warnings.
[ExpectedWarning("IL2072", nameof(GetWithPublicMethods), nameof(DataFlowTypeExtensions.RequiresPublicFields), Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)]
[ExpectedWarning("IL2072", nameof(GetWithPublicFields), nameof(DataFlowTypeExtensions.RequiresPublicMethods), Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)]
[ExpectedWarning("IL2072", nameof(GetWithPublicMethods), nameof(DataFlowTypeExtensions.RequiresPublicFields), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117155", CompilerGeneratedCode = true)]
[ExpectedWarning("IL2072", nameof(GetWithPublicFields), nameof(DataFlowTypeExtensions.RequiresPublicMethods), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117155", CompilerGeneratedCode = true)]
static async void NoFlowAcrossAwait()
{
Type t = GetWithPublicMethods();
Expand Down Expand Up @@ -454,7 +454,7 @@ public static void ReadCapturedParameterAfterWrite(Type tParameter = null)
void LocalFunction() => tParameter.RequiresPublicMethods();
}

[ExpectedWarning("IL2072", ["tParameter", nameof(GetWithPublicFields)], Tool.Analyzer, "")]
[ExpectedWarning("IL2072", ["tParameter", nameof(GetWithPublicFields)], Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117155")]
public static void ReadCapturedParameterAfterWriteMismatch([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type tParameter = null)
{
tParameter = GetWithPublicFields();
Expand Down Expand Up @@ -585,7 +585,7 @@ public static void ReadCapturedParameterAfterWrite(Type tParameter = null)
lambda();
}

[ExpectedWarning("IL2072", ["tParameter", nameof(GetWithPublicFields)], Tool.Analyzer, "")]
[ExpectedWarning("IL2072", ["tParameter", nameof(GetWithPublicFields)], Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117155")]
public static void ReadCapturedParameterAfterWriteMismatch([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type tParameter = null)
{
tParameter = GetWithPublicFields();
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,27 @@ class GenericTypeWithRequires<
// ArrayValues in the ValueSet for the pattern in this method, hitting the limit.
// When this happens, we replace the ValueSet with an unknown value, producing
// this warning.
[ExpectedWarning("IL2055", Tool.Analyzer, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")]
[UnexpectedWarning("IL2055", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
[ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")]
public static void Test<T>()
{
Type[] types = new Type[20] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static void TestIndirectGuard()
//
// The analyzer doesn't do constant propagation of the boolean, so it doesn't know that
// the return value is always false when TestFeatures.IsUnreferencedCodeSupported is false.
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool AndGuard => TestFeatures.IsUnreferencedCodeSupported && OtherCondition();

Expand Down Expand Up @@ -139,7 +139,7 @@ static void TestIsNotFalseGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool IfReturnTrueGuard
{
Expand All @@ -151,7 +151,7 @@ static bool IfReturnTrueGuard
}
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool ElseReturnTrueGuard
{
Expand Down Expand Up @@ -208,7 +208,7 @@ static void TestAssertNotReturnFalseGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool AssertReturnTrueGuard
{
Expand Down Expand Up @@ -242,7 +242,7 @@ static void TestThrowGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool TernaryIfGuard => TestFeatures.IsUnreferencedCodeSupported ? true : false;

Expand All @@ -252,7 +252,7 @@ static void TestTernaryIfGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool TernaryElseGuard => !TestFeatures.IsUnreferencedCodeSupported ? false : true;

Expand Down Expand Up @@ -289,7 +289,7 @@ public static void Test()

class InvalidGuardBodies
{
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool ReturnTrueGuard => true;

Expand All @@ -299,7 +299,7 @@ static void TestReturnTrueGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool OtherConditionGuard => OtherCondition();

Expand All @@ -309,7 +309,7 @@ static void TestOtherConditionGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool OrGuard => TestFeatures.IsUnreferencedCodeSupported || OtherCondition();

Expand All @@ -319,7 +319,7 @@ static void TestOrGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool NotGuard => !TestFeatures.IsUnreferencedCodeSupported;

Expand All @@ -329,7 +329,7 @@ static void TestNotGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool EqualsFalseGuard => TestFeatures.IsUnreferencedCodeSupported == false;

Expand All @@ -339,7 +339,7 @@ static void TestEqualsFalseGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool FalseEqualsGuard => false == TestFeatures.IsUnreferencedCodeSupported;

Expand All @@ -349,7 +349,7 @@ static void TestFalseEqualsGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool NotEqualsTrueGuard => TestFeatures.IsUnreferencedCodeSupported != true;

Expand All @@ -359,7 +359,7 @@ static void TestNotEqualsTrueGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool TrueNotEqualsGuard => true != TestFeatures.IsUnreferencedCodeSupported;

Expand All @@ -369,7 +369,7 @@ static void TestTrueNotEqualsGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool IsNotTrueGuard => TestFeatures.IsUnreferencedCodeSupported is not true;

Expand All @@ -379,7 +379,7 @@ static void TestIsNotTrueGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool IsFalseGuard => TestFeatures.IsUnreferencedCodeSupported is false;

Expand All @@ -389,7 +389,7 @@ static void TestIsFalseGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool IfReturnFalseGuard
{
Expand All @@ -407,7 +407,7 @@ static void TestIfReturnFalseGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool ElseReturnFalseGuard
{
Expand All @@ -426,7 +426,7 @@ static void TestElseReturnFalseGuard()
RequiresUnreferencedCode();
}

[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")]
[ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")]
[FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))]
static bool AssertNotReturnTrueGuard
{
Expand Down
Loading
Loading