@@ -19,6 +19,7 @@ public static void Main ()
19
19
TestInitializedReadFromOutParameter_PassedTwice ( ) ;
20
20
TestUninitializedReadFromOutParameter ( ) ;
21
21
TestInitializedReadFromOutParameter_MismatchOnOutput ( ) ;
22
+ TestInitializedReturnOutParameter_MismatchOnOutput ( ) ;
22
23
TestInitializedReadFromOutParameter_MismatchOnOutput_PassedTwice ( ) ;
23
24
TestInitializedReadFromOutParameter_MismatchOnInput ( ) ;
24
25
TestInitializedReadFromOutParameter_MismatchOnInput_PassedTwice ( ) ;
@@ -55,28 +56,36 @@ static void TestUninitializedReadFromOutParameter ()
55
56
typeWithMethods . RequiresPublicMethods ( ) ;
56
57
}
57
58
58
- [ ExpectedWarning ( "IL2067" , nameof ( DataFlowTypeExtensions . RequiresPublicFields ) ) ]
59
+ [ ExpectedWarning ( "IL2067" , nameof ( DataFlowTypeExtensions . RequiresPublicFields ) , Tool . Trimmer | Tool . NativeAot , "https://github.com/dotnet/linker/issues/2632" ) ]
59
60
static void TestInitializedReadFromOutParameter_MismatchOnOutput ( )
60
61
{
61
62
Type typeWithMethods = null ;
62
63
TryGetAnnotatedValue ( out typeWithMethods ) ;
63
64
typeWithMethods . RequiresPublicFields ( ) ;
64
65
}
65
66
66
- // https://github.com/dotnet/linker/issues/2632
67
67
// This test should generate a warning since there's mismatch on annotations
68
- [ ExpectedWarning ( "IL2067" , nameof ( DataFlowTypeExtensions . RequiresPublicFields ) ) ]
68
+ [ ExpectedWarning ( "IL2068" , nameof ( TryGetAnnotatedValue ) , nameof ( DynamicallyAccessedMemberTypes . PublicFields ) , Tool . Trimmer | Tool . NativeAot , "https://github.com/dotnet/linker/issues/2632" ) ]
69
+ [ return : DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicFields ) ]
70
+ static Type TestInitializedReturnOutParameter_MismatchOnOutput ( )
71
+ {
72
+ Type typeWithMethods = null ;
73
+ TryGetAnnotatedValue ( out typeWithMethods ) ;
74
+ return typeWithMethods ;
75
+ }
76
+
77
+ // This test should generate a warning since there's mismatch on annotations
78
+ [ ExpectedWarning ( "IL2067" , nameof ( DataFlowTypeExtensions . RequiresPublicFields ) , Tool . Trimmer | Tool . NativeAot , "https://github.com/dotnet/linker/issues/2632" ) ]
69
79
static void TestInitializedReadFromOutParameter_MismatchOnOutput_PassedTwice ( )
70
80
{
71
81
Type typeWithMethods = null ;
72
82
TryGetAnnotatedValueFromValue ( typeWithMethods , out typeWithMethods ) ;
73
83
typeWithMethods . RequiresPublicFields ( ) ;
74
84
}
75
85
76
- // https://github.com/dotnet/linker/issues/2632
77
86
// This warning should not be generated, the value of typeWithMethods should have PublicMethods
78
87
// after the call with out parameter.
79
- [ ExpectedWarning ( "IL2072" , nameof ( DataFlowTypeExtensions . RequiresPublicMethods ) , Tool . Analyzer , "" ) ]
88
+ [ ExpectedWarning ( "IL2072" , nameof ( DataFlowTypeExtensions . RequiresPublicMethods ) , Tool . Analyzer , "https://github.com/dotnet/linker/issues/2632 " ) ]
80
89
static void TestInitializedReadFromOutParameter_MismatchOnInput ( )
81
90
{
82
91
Type typeWithMethods = GetTypeWithFields ( ) ;
@@ -86,10 +95,9 @@ static void TestInitializedReadFromOutParameter_MismatchOnInput ()
86
95
}
87
96
88
97
[ ExpectedWarning ( "IL2072" , nameof ( TryGetAnnotatedValueFromValue ) ) ]
89
- // https://github.com/dotnet/linker/issues/2632
90
98
// This warning should not be generated, the value of typeWithMethods should have PublicMethods
91
99
// after the call with out parameter.
92
- [ ExpectedWarning ( "IL2072" , nameof ( DataFlowTypeExtensions . RequiresPublicMethods ) , Tool . Analyzer , "" ) ]
100
+ [ ExpectedWarning ( "IL2072" , nameof ( DataFlowTypeExtensions . RequiresPublicMethods ) , Tool . Analyzer , "https://github.com/dotnet/linker/issues/2632 " ) ]
93
101
static void TestInitializedReadFromOutParameter_MismatchOnInput_PassedTwice ( )
94
102
{
95
103
Type typeWithMethods = GetTypeWithFields ( ) ;
@@ -103,7 +111,7 @@ static void TestPassingOutParameter ([DynamicallyAccessedMembers (DynamicallyAcc
103
111
TryGetAnnotatedValue ( out typeWithMethods ) ;
104
112
}
105
113
106
- [ ExpectedWarning ( "IL2067" , "typeWithFields" , nameof ( TryGetAnnotatedValue ) ) ]
114
+ [ ExpectedWarning ( "IL2067" , "typeWithFields" , nameof ( TryGetAnnotatedValue ) , Tool . Trimmer | Tool . NativeAot , "https://github.com/dotnet/linker/issues/2632" ) ]
107
115
static void TestPassingOutParameter_Mismatch ( [ DynamicallyAccessedMembers ( DynamicallyAccessedMemberTypes . PublicFields ) ] out Type typeWithFields )
108
116
{
109
117
TryGetAnnotatedValue ( out typeWithFields ) ;
0 commit comments