@@ -54,11 +54,11 @@ Value.Zero = Value.Create 0 |> ignore"""
54
54
|> compileExeAndRun
55
55
|> shouldSucceed
56
56
57
- [<InlineData( false , " private" , " assembly" ) >] // Legacy, private WrapType, private visibility in IL
57
+ [<InlineData( false , " private" , " assembly" ) >] // Legacy, private WrapType, assembly visibility in IL
58
58
[<InlineData( false , " internal" , " assembly" ) >] // RealSig, internal WrapType, assembly visibility in IL
59
59
[<InlineData( false , " public" , " public" ) >] // Legacy, public WrapType, public visibility in IL
60
- [<InlineData( true , " private" , " private " ) >] // RealSig, private WrapType, private visibility in IL
61
- [<InlineData( true , " internal" , " assembly " ) >] // RealSig, internal WrapType, assembly visibility in IL
60
+ [<InlineData( true , " private" , " public " ) >] // RealSig, private WrapType, public visibility in IL
61
+ [<InlineData( true , " internal" , " public " ) >] // RealSig, internal WrapType, public visibility in IL
62
62
[<InlineData( true , " public" , " public" ) >] // RealSig, public WrapType, public visibility in IL
63
63
[<Theory>]
64
64
let ``Generated typed Equals`` ( realsig , typeScope , targetVisibility ) =
@@ -81,9 +81,7 @@ module Module1 =
81
81
|> shouldSucceed
82
82
|> verifyIL [
83
83
$"""
84
- .method {targetVisibility} hidebysig instance bool
85
- Equals(valuetype Program/Module1/Struct obj,
86
- class [runtime]System.Collections.IEqualityComparer comp) cil managed
84
+ .method {targetVisibility} hidebysig instance bool Equals(valuetype Program/Module1/Struct obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed
87
85
{{
88
86
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
89
87
@@ -106,24 +104,24 @@ module Module1 =
106
104
}} """ ]
107
105
108
106
109
- [<InlineData( false , " private" ) >] // Legacy, private record fields, private visibility in IL
110
- [<InlineData( false , " internal" ) >] // RealSig, internal record fields, assembly visibility in IL
111
- [<InlineData( false , " public" ) >] // Legacy, public record fields, public visibility in IL
112
- [<InlineData( true , " private" ) >] // RealSig, private record fields, private visibility in IL
113
- [<InlineData( true , " internal" ) >] // RealSig, internal record fields, assembly visibility in IL
114
- [<InlineData( true , " public" ) >] // RealSig, public record fields, public visibility in IL
107
+ [<InlineData( false , " private" ) >] // Legacy, private WrapType
108
+ [<InlineData( false , " internal" ) >] // RealSig, internal WrapType
109
+ [<InlineData( false , " public" ) >] // Legacy, public WrapType
110
+ [<InlineData( true , " private" ) >] // RealSig, private WrapType
111
+ [<InlineData( true , " internal" ) >] // RealSig, internal WrapType
112
+ [<InlineData( true , " public" ) >] // RealSig, public WrapType
115
113
[<Theory>]
116
- let ``Record with various fields`` ( realsig , fieldScope ) =
114
+ let ``Record with various scoped fields`` ( realsig , fieldScope ) =
117
115
118
116
let mainModule =
119
117
FSharpWithFileName " Program.fs"
120
- $"""
118
+ $$ """
121
119
module Module1 =
122
120
type Value =
123
- {fieldScope} {{ value: uint32 } }
121
+ {{ fieldScope}} { value: uint32 }
124
122
125
- static member Zero = {{ value = 0u } }
126
- static member Create(value: int) = {{ value = uint value } }
123
+ static member Zero = { value = 0u }
124
+ static member Create(value: int) = { value = uint value }
127
125
128
126
Value.Zero = Value.Create 0 |> ignore
129
127
printfn "Hello, World" """
@@ -134,7 +132,7 @@ module Module1 =
134
132
|> shouldSucceed
135
133
|> verifyIL [
136
134
"""
137
- .method public hidebysig virtual final instance bool Equals(class Program/Module1/Value obj) cil managed
135
+ .method public hidebysig instance bool Equals(class Program/Module1/Value obj, class [runtime]System.Collections.IEqualityComparer comp ) cil managed
138
136
{
139
137
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
140
138
@@ -161,26 +159,27 @@ module Module1 =
161
159
IL_001b: ldc.i4.0
162
160
IL_001c: ceq
163
161
IL_001e: ret
164
- } """
165
- """
166
- IL_0020: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer()
167
- IL_0025: callvirt instance bool Program/Module1/Value::Equals(class Program/Module1/Value,
168
- class [runtime]System.Collections.IEqualityComparer)
169
- """ ]
170
-
171
-
172
- [<InlineData( false , " private" , " assembly" ) >] // Legacy, private WrapType, private visibility in IL
173
- [<InlineData( false , " internal" , " assembly" ) >] // RealSig, internal WrapType, assembly visibility in IL
174
- [<InlineData( false , " public" , " public" ) >] // Legacy, public WrapType, public visibility in IL
175
- [<InlineData( true , " private" , " private" ) >] // RealSig, private WrapType, private visibility in IL
176
- [<InlineData( true , " internal" , " assembly" ) >] // RealSig, internal WrapType, assembly visibility in IL
177
- [<InlineData( true , " public" , " public" ) >] // RealSig, public WrapType, public visibility in IL
162
+ } """ ]
163
+
164
+
165
+ [<InlineData( false , " public" , " private" , " assembly" ) >] // public module - Legacy, private WrapType, private visibility in IL
166
+ [<InlineData( false , " public" , " internal" , " assembly" ) >] // public module - RealSig, internal WrapType, assembly visibility in IL
167
+ [<InlineData( false , " public" , " public" , " public" ) >] // public module - Legacy, public WrapType, public visibility in IL
168
+ [<InlineData( true , " public" , " private" , " public" ) >] // public module - RealSig, private WrapType, public visibility in IL
169
+ [<InlineData( true , " public" , " internal" , " public" ) >] // public module - RealSig, internal WrapType, public visibility in IL
170
+ [<InlineData( true , " public" , " public" , " public" ) >] // public module - RealSig, public WrapType, public visibility in IL
171
+ [<InlineData( false , " private" , " private" , " assembly" ) >] // private module - Legacy, private WrapType, private visibility in IL
172
+ [<InlineData( false , " private" , " internal" , " assembly" ) >] // private module - RealSig, internal WrapType, assembly visibility in IL
173
+ [<InlineData( false , " private" , " public" , " assembly" ) >] // private module - Legacy, public WrapType, assembly visibility in IL
174
+ [<InlineData( true , " private" , " private" , " public" ) >] // private module - RealSig, private WrapType, public visibility in IL
175
+ [<InlineData( true , " private" , " internal" , " public" ) >] // private module - RealSig, internal WrapType, public visibility in IL
176
+ [<InlineData( true , " private" , " public" , " public" ) >] // private module - RealSig, public WrapType, public visibility in IL
178
177
[<Theory>]
179
- let ``scoped type arg `` ( realsig , argScope , targetVisibility ) =
178
+ let ``scoped main and scoped type Equals `` ( realsig , moduleScope , argScope , targetVisibility ) =
180
179
let mainModule =
181
180
FSharpWithFileName " Program.fs"
182
181
$"""
183
- module IPartialEqualityComparer =
182
+ module {moduleScope} IPartialEqualityComparer =
184
183
open System.Collections.Generic
185
184
186
185
[<StructuralEquality; NoComparison>]
@@ -195,9 +194,7 @@ module IPartialEqualityComparer =
195
194
|> shouldSucceed
196
195
|> verifyIL [
197
196
$"""
198
- .method {targetVisibility} hidebysig instance bool
199
- Equals(class Program/IPartialEqualityComparer/WrapType`1<!T> obj,
200
- class [runtime]System.Collections.IEqualityComparer comp) cil managed
197
+ .method {targetVisibility} hidebysig instance bool Equals(class Program/IPartialEqualityComparer/WrapType`1<!T> obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed
201
198
{{
202
199
.custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
203
200
0 commit comments