Skip to content

Commit 824b4e4

Browse files
authored
Refactor component test compilation (#14747)
* refactor testdriver * Netstandard test case
1 parent 3c80121 commit 824b4e4

File tree

12 files changed

+974
-82
lines changed

12 files changed

+974
-82
lines changed

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,16 @@ nCrunchTemp_*
125125

126126
tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.actual
127127
*.vsp
128+
/Z.fs
129+
/Y.fs
130+
/X.fs
131+
/Library.fs
132+
/Ghost.fs
133+
/D.fsi
134+
/D.fs
135+
/C.fsi
136+
/C.fs
137+
/B.fsi
138+
/B.fs
139+
/A.fsi
140+
/A.fs

tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ module Misc =
1010
let verifyCompilation compilation =
1111
compilation
1212
|> withOptions [ "--test:EmitFeeFeeAs100001" ]
13-
|> asExe
1413
|> withNoOptimize
1514
|> withEmbeddedPdb
1615
|> withEmbedAllSource
@@ -21,167 +20,202 @@ module Misc =
2120
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AnonRecd.fs"|])>]
2221
let ``AnonRecd_fs`` compilation =
2322
compilation
23+
|> asExe
2424
|> verifyCompilation
2525

2626
// SOURCE=CodeGenRenamings01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd CodeGenRenamings01.exe" # CodeGenRenamings01.fs -
2727
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"CodeGenRenamings01.fs"|])>]
2828
let ``CodeGenRenamings01_fs`` compilation =
2929
compilation
30+
|> asExe
3031
|> verifyCompilation
3132

3233
// SOURCE=ArgumentNamesInClosures01.fs SCFLAGS="-a -g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ArgumentNamesInClosures01.dll" # ArgumentNamesInClosures01.fs -
3334
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ArgumentNamesInClosures01.fs"|])>]
3435
let ``ArgumentNamesInClosures01_fs`` compilation =
3536
compilation
37+
|> asExe
3638
|> verifyCompilation
3739

3840
// SOURCE=Decimal01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Decimal01.exe" # Decimal01.fs
3941
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Decimal01.fs"|])>]
4042
let ``Decimal01_fs`` compilation =
4143
compilation
44+
|> asExe
4245
|> verifyCompilation
4346

4447
// SOURCE=EntryPoint01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd EntryPoint01.exe" # EntryPoint01.fs
4548
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"EntryPoint01.fs"|])>]
4649
let ``EntryPoint01_fs`` compilation =
4750
compilation
51+
|> asExe
4852
|> verifyCompilation
4953

5054
// SOURCE=EqualsOnUnions01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd EqualsOnUnions01.exe" # EqualsOnUnions01.fs -
5155
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"EqualsOnUnions01.fs"|])>]
5256
let ``EqualsOnUnions01_fs`` compilation =
5357
compilation
58+
|> asExe
5459
|> verifyCompilation
5560

5661
// SOURCE=ForLoop01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ForLoop01.exe" # ForLoop01.fs -
5762
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ForLoop01.fs"|])>]
5863
let ``ForLoop01_fs`` compilation =
5964
compilation
65+
|> asExe
6066
|> verifyCompilation
6167

6268
// SOURCE=ForLoop02.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ForLoop02.exe" # ForLoop02.fs
6369
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ForLoop02.fs"|])>]
6470
let ``ForLoop02_fs`` compilation =
6571
compilation
72+
|> asExe
6673
|> verifyCompilation
6774

6875
// SOURCE=ForLoop03.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ForLoop03.exe" # ForLoop03.fs
6976
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ForLoop02.fs"|])>]
7077
let ``ForLoop03_fs`` compilation =
7178
compilation
79+
|> asExe
7280
|> verifyCompilation
7381

7482
// SOURCE=NoBoxingOnDispose01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd NoBoxingOnDispose01.exe" # NoBoxingOnDispose01.fs
7583
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"NoBoxingOnDispose01.fs"|])>]
7684
let ``NoBoxingOnDispose01_fs`` compilation =
7785
compilation
86+
|> asExe
7887
|> verifyCompilation
7988

8089
//SOURCE=IfThenElse01.fs SCFLAGS="-a -g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd IfThenElse01.dll" # IfThenElse01.fs
8190
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"IfThenElse01.fs"|])>]
8291
let ``IfThenElse01_fs`` compilation =
8392
compilation
93+
|> asExe
8494
|> verifyCompilation
8595

8696
// SOURCE=LetIfThenElse01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd LetIfThenElse01.exe" # LetIfThenElse01.fs -
8797
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"LetIfThenElse01.fs"|])>]
8898
let ``LetIfThenElse01_fs`` compilation =
8999
compilation
100+
|> asExe
90101
|> verifyCompilation
91102

92103
// SOURCE=Lock01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Lock01.exe" # Lock01.fs -
93104
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Lock01.fs"|])>]
94105
let ``Lock01_fs`` compilation =
95106
compilation
107+
|> asExe
96108
|> verifyCompilation
97109

98110
// SOURCE=ModuleWithExpression01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ModuleWithExpression01.exe" # ModuleWithExpression01.fs
99111
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ModuleWithExpression01.fs"|])>]
100112
let ``ModuleWithExpression01_fs`` compilation =
101113
compilation
114+
|> asExe
102115
|> verifyCompilation
103116

104117
// SOURCE=NonEscapingArguments02.fs SCFLAGS="-a -g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd NonEscapingArguments02.dll" # NonEscapingArguments02.fs
105118
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"NonEscapingArguments02.fs"|])>]
106119
let ``NonEscapingArguments02_fs`` compilation =
107120
compilation
121+
|> asExe
108122
|> verifyCompilation
109123

110124
// SOURCE=Seq_for_all01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Seq_for_all01.exe" # Seq_for_all01.fs
111125
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Seq_for_all01.fs"|])>]
112126
let ``Seq_for_all01_fs`` compilation =
113127
compilation
128+
|> asExe
114129
|> verifyCompilation
115130

116131
// SOURCE=StructsAsArrayElements01.fs SCFLAGS="-a -g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd StructsAsArrayElements01.dll" # StructsAsArrayElements01.fs -
117132
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"StructsAsArrayElements01.fs"|])>]
118133
let ``StructsAsArrayElements01_fs`` compilation =
119134
compilation
135+
|> asExe
120136
|> verifyCompilation
121137

122138
// SOURCE=PreserveSig.fs SCFLAGS="-a -g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd PreserveSig.dll" # PreserveSig.fs -
123139
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"PreserveSig.fs"|])>]
124140
let ``PreserveSig_fs`` compilation =
125141
compilation
142+
|> asExe
126143
|> verifyCompilation
127144

128145
// # The name of this test is a bit misleading for legacy reasons: it used to test the --no-generate-filter-blocks option, which is now gone
129146
// SOURCE=TryWith_NoFilterBlocks01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TryWith_NoFilterBlocks01.exe" # TryWith_NoFilterBlocks01.fs
130147
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"TryWith_NoFilterBlocks01.fs"|])>]
131148
let ``TryWith_NoFilterBlocks01_fs`` compilation =
132149
compilation
150+
|> asExe
133151
|> verifyCompilation
134152

135153
// SOURCE=Structs01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Structs01.exe" # Structs01.fs -
136154
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Structs01.fs"|])>]
137155
let ``Structs01_fs`` compilation =
138156
compilation
157+
|> asExe
139158
|> verifyCompilation
140159

141160
// SOURCE=Structs02.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Structs02.exe" # Structs02.fs -
142161
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Structs02.fs"|])>]
143162
let ``Structs02_fs`` compilation =
144163
compilation
164+
|> asExe
145165
|> verifyCompilation
146166

167+
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Structs02_asNetStandard20.fs"|])>]
168+
let ``Structs02_asNetStandard20_fs`` compilation =
169+
compilation
170+
|>asLibrary
171+
|>asNetStandard20
172+
|>verifyCompilation
173+
147174
// SOURCE=Marshal.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Marshal.exe" # Marshal.fs
148175
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"Marshal.fs"|])>]
149176
let ``Marshal_fs`` compilation =
150177
compilation
178+
|> asExe
151179
|> verifyCompilation
152180

153181
// SOURCE=MethodImplNoInline.fs SCFLAGS="-O" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd MethodImplNoInline.exe" # MethodImplNoInline.fs
154182
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ForLoop02.fs"|])>]
155183
let ``MethodImplNoInline_fs`` compilation =
156184
compilation
185+
|> asExe
157186
|> verifyCompilation
158187

159188
// SOURCE=MethodImplNoInline02.fs SCFLAGS="-O" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd MethodImplNoInline02.exe" # MethodImplNoInline02.fs
160189
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"MethodImplNoInline02.fs"|])>]
161190
let ``MethodImplNoInline02_fs`` compilation =
162191
compilation
192+
|> asExe
163193
|> verifyCompilation
164194

165195
// SOURCE=CustomAttributeGenericParameter01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd CustomAttributeGenericParameter01.exe" # CustomAttributeGenericParameter01.fs -
166196
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"CustomAttributeGenericParameter01.fs"|])>]
167197
let ``CustomAttributeGenericParameter01_fs`` compilation =
168198
compilation
199+
|> asExe
169200
|> verifyCompilation
170201

171202
// SOURCE=GenericTypeStaticField.fs SCFLAGS="-g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd GenericTypeStaticField.exe" # GenericTypeStaticField.fs -
172203
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"GenericTypeStaticField.fs"|])>]
173204
let ``GenericTypeStaticField_fs`` compilation =
174205
compilation
206+
|> asExe
175207
|> verifyCompilation
176208

177209
// SOURCE=GeneralizationOnUnions01.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd GeneralizationOnUnions01.exe" # GeneralizationOnUnions01.fs
178210
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"GeneralizationOnUnions01.fs"|])>]
179211
let ``GeneralizationOnUnions01_fs`` compilation =
180212
compilation
213+
|> asExe
181214
|> verifyCompilation
182215

183216
// SOURCE=AbstractClass.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd AbstractClass.exe" # AbstractClass.fs
184217
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AbstractClass.fs"|])>]
185218
let ``AbstractClass_fs`` compilation =
186219
compilation
220+
|> asExe
187221
|> verifyCompilation
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// regression test for 767815: Invalid code is generated when using field initializers in struct constructor
2+
3+
module Experiment.Test
4+
5+
[<Struct>]
6+
type Repro =
7+
val hash : int
8+
new(length) =
9+
{ hash =
10+
let mutable h = 0
11+
for i=0 to length-1 do
12+
h <- 26*h
13+
h
14+
}
15+
16+
let test() =
17+
let t = Repro(42)
18+
t.hash

0 commit comments

Comments
 (0)