-
Notifications
You must be signed in to change notification settings - Fork 789
/
AttributeUsage.fs
662 lines (592 loc) · 33.6 KB
/
AttributeUsage.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace Conformance.BasicGrammarElements
open Xunit
open FSharp.Test
open FSharp.Test.Compiler
module CustomAttributes_AttributeUsage =
let verifyCompile compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compile
let verifyCompileAndRun compilation =
compilation
|> asExe
|> withOptions ["--nowarn:988"]
|> compileAndRun
// SOURCE=AssemblyVersion01.fs # AssemblyVersion01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion01.fs"|])>]
let ``AssemblyVersion01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AssemblyVersion02.fs # AssemblyVersion02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion02.fs"|])>]
let ``AssemblyVersion02_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AssemblyVersion03.fs # AssemblyVersion03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion03.fs"|])>]
let ``AssemblyVersion03_fs`` compilation =
compilation
|> withOptions ["--nowarn:52"]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AssemblyVersion04.fs # AssemblyVersion04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion04.fs"|])>]
let ``AssemblyVersion04_fs`` compilation =
compilation
|> withOptions ["--nowarn:52"]
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AttributeTargetsIsCtor01.fs # AttributeTargetsIsCtor01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsCtor01.fs"|])>]
let ``AttributeTargetsIsCtor01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AttributeTargetsIsMethod01.fs # AttributeTargetsIsMethod01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsMethod01.fs"|])>]
let ``AttributeTargetsIsMethod01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AttributeTargetsIsMethod01.fs # AttributeTargetsIsMethod01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsMethod01.fs"|])>]
let ``AttributeTargetsIsMethod01_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=AttributeTargetsIsProperty.fs # AttributeTargetsIsProperty.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsProperty.fs"|])>]
let ``AttributeTargetsIsProperty_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=AttributeTargetsIsProperty.fs # AttributeTargetsIsProperty.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsProperty.fs"|])>]
let ``AttributeTargetsIsProperty_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldSucceed
// SOURCE=ConditionalAttribute.fs # ConditionalAttribute.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"ConditionalAttribute.fs"|])>]
let ``ConditionalAttribute_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=E_AttributeTargets01.fs # E_AttributeTargets01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargets01.fs"|])>]
let ``E_AttributeTargets01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 21, Col 21, Line 21, Col 22, "This attribute is not valid for use on this language element")
(Error 842, Line 24, Col 21, Line 24, Col 29, "This attribute is not valid for use on this language element")
(Error 842, Line 27, Col 7, Line 27, Col 16, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeTargets02.fs # E_AttributeTargets02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargets02.fs"|])>]
let ``E_AttributeTargets02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 14, Col 7, Line 14, Col 34, "This attribute is not valid for use on this language element")
(Error 842, Line 24, Col 7, Line 24, Col 36, "This attribute is not valid for use on this language element")
(Error 842, Line 29, Col 15, Line 29, Col 47, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeTargetIsField01.fs # E_AttributeTargetIsField01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsField01.fs"|])>]
let ``E_AttributeTargetIsField01_fs`` compilation =
compilation
|> withLangVersion80
|> withOptions ["--nowarn:25"]
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsField01.fs # E_AttributeTargetIsField01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsField01.fs"|])>]
let ``E_AttributeTargetIsField01_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> withOptions ["--nowarn:25"]
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 9, Col 3, Line 9, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 12, Col 3, Line 12, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 15, Col 3, Line 15, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 18, Col 3, Line 18, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 21, Col 3, Line 21, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 24, Col 3, Line 24, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 27, Col 3, Line 27, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 30, Col 3, Line 30, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 33, Col 3, Line 33, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 36, Col 3, Line 36, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 39, Col 3, Line 39, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 42, Col 3, Line 42, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 45, Col 3, Line 45, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 49, Col 3, Line 49, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 56, Col 3, Line 56, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 64, Col 3, Line 64, Col 12, "This attribute is not valid for use on this language element")
(Error 842, Line 66, Col 7, Line 66, Col 16, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeTargetIsField02.fs # E_AttributeTargetIsField02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsField02.fs"|])>]
let ``E_AttributeTargetIsField02_fs`` compilation =
compilation
|> withLangVersion80
|> withOptions ["--nowarn:25"]
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsField02.fs # E_AttributeTargetIsField02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsField02.fs"|])>]
let ``E_AttributeTargetIsField02_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> withOptions ["--nowarn:25"]
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsMethod02.fs # E_AttributeTargetIsMethod02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsMethod02.fs"|])>]
let ``E_AttributeTargetIsMethod02_fs`` compilation =
compilation
|> withLangVersion80
|> withOptions ["--nowarn:25"]
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsMethod02.fs # E_AttributeTargetIsMethod02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsMethod02.fs"|])>]
let ``E_AttributeTargetIsMethod02_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> withOptions ["--nowarn:25"]
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 9, Col 3, Line 9, Col 13, "This attribute is not valid for use on this language element")
(Error 842, Line 12, Col 3, Line 12, Col 13, "This attribute is not valid for use on this language element")
(Error 842, Line 15, Col 3, Line 15, Col 13, "This attribute is not valid for use on this language element")
(Error 842, Line 18, Col 3, Line 18, Col 13, "This attribute is not valid for use on this language element")
(Error 842, Line 21, Col 3, Line 21, Col 13, "This attribute is not valid for use on this language element")
(Error 842, Line 24, Col 3, Line 24, Col 13, "This attribute is not valid for use on this language element")
(Error 842, Line 26, Col 7, Line 26, Col 17, "This attribute is not valid for use on this language element")
(Error 842, Line 28, Col 3, Line 28, Col 13, "This attribute is not valid for use on this language element")
(Error 842, Line 31, Col 3, Line 31, Col 13, "This attribute is not valid for use on this language element")
(Error 842, Line 34, Col 3, Line 34, Col 13, "This attribute is not valid for use on this language element")
(Error 842, Line 39, Col 3, Line 39, Col 13, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeTargetIsMethod03.fs # E_AttributeTargetIsMethod03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsMethod03.fs"|])>]
let ``E_AttributeTargetIsMethod03_fs`` compilation =
compilation
|> withLangVersion80
|> withOptions ["--nowarn:25"]
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsMethod03.fs # E_AttributeTargetIsMethod03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsMethod03.fs"|])>]
let ``E_AttributeTargetIsMethod03_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> withOptions ["--nowarn:25"]
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 12, Col 6, Line 12, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 15, Col 6, Line 15, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 18, Col 6, Line 18, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 20, Col 10, Line 20, Col 20, "This attribute is not valid for use on this language element")
(Error 842, Line 22, Col 6, Line 22, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 25, Col 6, Line 25, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 28, Col 6, Line 28, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 31, Col 6, Line 31, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 34, Col 6, Line 34, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 37, Col 6, Line 37, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 39, Col 10, Line 39, Col 20, "This attribute is not valid for use on this language element")
(Error 842, Line 41, Col 6, Line 41, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 44, Col 6, Line 44, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 47, Col 6, Line 47, Col 16, "This attribute is not valid for use on this language element")
(Error 842, Line 52, Col 6, Line 52, Col 16, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeTargetIsMethod04.fs # E_AttributeTargetIsMethod04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsMethod04.fs"|])>]
let ``E_AttributeTargetIsMethod04_fs`` compilation =
compilation
|> withOptions ["--nowarn:25"]
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 10, Col 3, Line 10, Col 15, "This attribute is not valid for use on this language element")
(Error 842, Line 13, Col 3, Line 13, Col 15, "This attribute is not valid for use on this language element")
]
// SOURCE=E_ConditionalAttribute.fs SCFLAGS="--test:ErrorRanges" # E_ConditionalAttribute.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_ConditionalAttribute.fs"|])>]
let ``E_ConditionalAttribute_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 1213, Line 10, Col 6, Line 10, Col 9, "Attribute 'System.Diagnostics.ConditionalAttribute' is only valid on methods or attribute classes")
]
// SOURCE=E_RequiresExplicitTypeArguments01.fs SCFLAGS="--test:ErrorRanges" # E_RequiresExplicitTypeArguments01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_RequiresExplicitTypeArguments01.fs"|])>]
let ``E_RequiresExplicitTypeArguments01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 685, Line 14, Col 1, Line 14, Col 6, "The generic function 'Foo' must be given explicit type argument(s)")
(Error 685, Line 26, Col 1, Line 26, Col 6, "The generic function 'Foo' must be given explicit type argument(s)")
(Error 685, Line 28, Col 1, Line 28, Col 6, "The generic function 'Foo' must be given explicit type argument(s)")
]
// SOURCE=E_RequiresExplicitTypeArguments02.fs SCFLAGS="--test:ErrorRanges" # E_RequiresExplicitTypeArguments02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_RequiresExplicitTypeArguments02.fs"|])>]
let ``E_RequiresExplicitTypeArguments02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 685, Line 20, Col 5, Line 20, Col 10, "The generic function 'Foo' must be given explicit type argument(s)")
]
// SOURCE=E_WithBitwiseOr01.fsx SCFLAGS="--test:ErrorRanges -a" # E_WithBitwiseOr01.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_WithBitwiseOr01.fsx"|])>]
let ``E_WithBitwiseOr01_fsx`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 12, Col 3, Line 12, Col 6, "This attribute is not valid for use on this language element")
]
// SOURCE=AttributeTargetIsStruct.fs # AttributeTargetIsStruct.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsStruct.fs"|])>]
let ``AttributeTargetIsStruct_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=AttributeTargetIsStruct.fs # AttributeTargetIsStruct.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsStruct.fs"|])>]
let ``AttributeTargetIsStruct_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldSucceed
// SOURCE=AttributeTargetIsClass.fs # AttributeTargetIsClass.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsClass.fs"|])>]
let ``AttributeTargetIsClass_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=AttributeTargetIsClass.fs # AttributeTargetIsClass.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsClass.fs"|])>]
let ``AttributeTargetIsClass_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsStruct.fs # E_AttributeTargetIsStruct.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsStruct.fs"|])>]
let ``E_AttributeTargetIsStruct_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsStruct.fs # E_AttributeTargetIsStruct.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsStruct.fs"|])>]
let ``E_AttributeTargetIsStruct_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 13, Col 3, Line 13, Col 14, "This attribute is not valid for use on this language element")
(Error 842, Line 19, Col 3, Line 19, Col 14, "This attribute is not valid for use on this language element")
(Error 842, Line 22, Col 11, Line 22, Col 22, "This attribute is not valid for use on this language element")
(Error 842, Line 25, Col 3, Line 25, Col 14, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeTargetIsClass.fs # E_AttributeTargetIsClass.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass.fs"|])>]
let ``E_AttributeTargetIsClass_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsClass01.fs # E_AttributeTargetIsClass01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass01.fs"|])>]
let ``E_AttributeTargetIsClass01_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsClass.fs # E_AttributeTargetIsClass.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass.fs"|])>]
let ``E_AttributeTargetIsClass_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 13, Col 3, Line 13, Col 15, "This attribute is not valid for use on this language element")
(Error 842, Line 19, Col 3, Line 19, Col 15, "This attribute is not valid for use on this language element")
(Error 842, Line 22, Col 10, Line 22, Col 22, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeTargetIsClass01.fs # E_AttributeTargetIsClass01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass01.fs"|])>]
let ``E_AttributeTargetIsClass01_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 7, Col 3, Line 7, Col 18, "This attribute is not valid for use on this language element")
(Error 842, Line 10, Col 10, Line 10, Col 25, "This attribute is not valid for use on this language element")
]
// SOURCE=MarshalAsAttribute.fs # MarshalAsAttribute.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"MarshalAsAttribute.fs"|])>]
let ``MarshalAsAttribute_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=RequiresExplicitTypeArguments01.fs # RequiresExplicitTypeArguments01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"RequiresExplicitTypeArguments01.fs"|])>]
let ``RequiresExplicitTypeArguments01_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=RequiresExplicitTypeArguments02.fs # RequiresExplicitTypeArguments02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"RequiresExplicitTypeArguments02.fs"|])>]
let ``RequiresExplicitTypeArguments02_fs`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=W_AssemblyVersion01.fs SCFLAGS="--test:ErrorRanges" # W_AssemblyVersion01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"W_AssemblyVersion01.fs"|])>]
let ``W_AssemblyVersion01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 2003, Line 4, Col 46, Line 4, Col 59, "The attribute System.Reflection.AssemblyVersionAttribute specified version '1.2.3.4.5.6', but this value is invalid and has been ignored")
]
// SOURCE=W_AssemblyVersion02.fs SCFLAGS="--test:ErrorRanges" # W_AssemblyVersion02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"W_AssemblyVersion02.fs"|])>]
let ``W_AssemblyVersion02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 2003, Line 4, Col 46, Line 4, Col 55, "The attribute System.Reflection.AssemblyVersionAttribute specified version '1.2.*.4', but this value is invalid and has been ignored")
]
// SOURCE=WithBitwiseOr02a.fsx SCFLAGS=-a # WithBitwiseOr02a.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"WithBitwiseOr02a.fsx"|])>]
let ``WithBitwiseOr02a_fsx`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=WithBitwiseOr02b.fsx SCFLAGS=-a # WithBitwiseOr02b.fsx
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"WithBitwiseOr02b.fsx"|])>]
let ``WithBitwiseOr02b_fsx`` compilation =
compilation
|> verifyCompileAndRun
|> shouldSucceed
// SOURCE=X_AssemblyVersion01.fs SCFLAGS="--test:ErrorRanges" # X_AssemblyVersion01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"X_AssemblyVersion01.fs"|])>]
let ``X_AssemblyVersion01_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 2003, Line 5, Col 50, Line 5, Col 61, "The attribute System.Reflection.AssemblyFileVersionAttribute specified version '9.8.7.6.5', but this value is invalid and has been ignored")
]
// SOURCE=X_AssemblyVersion02.fs SCFLAGS="--test:ErrorRanges" # X_AssemblyVersion02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"X_AssemblyVersion02.fs"|])>]
let ``X_AssemblyVersion02_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Warning 2003, Line 5, Col 59, Line 5, Col 68, "The attribute System.Reflection.AssemblyFileVersionAttribute specified version '9.8.*.6', but this value is invalid and has been ignored")
]
// SOURCE=E_AttributeTargetIsField03.fs # E_AttributeTargetIsField03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsField03.fs"|])>]
let ``E_AttributeTargetIsField03_fs`` compilation =
compilation
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 14, Col 5, Line 14, Col 15, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeTargetIsField03.fs # E_AttributeTargetIsField03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsField03.fs"|])>]
let ``E_AttributeTargetIsField03_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 14, Col 5, Line 14, Col 15, "This attribute is not valid for use on this language element")
(Error 842, Line 15, Col 5, Line 15, Col 25, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeTargetIsProperty01.fs # E_AttributeTargetIsField03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsProperty01.fs"|])>]
let ``E_AttributeTargetIsProperty01_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsProperty01.fs # E_AttributeTargetIsField03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsProperty01.fs"|])>]
let ``E_AttributeTargetIsProperty01_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 14, Col 5, Line 14, Col 18, "This attribute is not valid for use on this language element")
(Error 842, Line 15, Col 5, Line 15, Col 25, "This attribute is not valid for use on this language element")
]
// SOURCE=E_AttributeTargetIsCtor01.fs # E_AttributeTargetIsCtor01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsCtor01.fs"|])>]
let ``E_AttributeTargetIsCtor01_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsCtor01.fs # E_AttributeTargetIsCtor01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsCtor01.fs"|])>]
let ``E_AttributeTargetIsCtor01_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 9, Col 15, Line 9, Col 27, "This attribute is not valid for use on this language element")
(Error 842, Line 11, Col 16, Line 11, Col 28, "This attribute is not valid for use on this language element")
(Error 842, Line 14, Col 15, Line 14, Col 27, "This attribute is not valid for use on this language element")
(Error 842, Line 17, Col 16, Line 17, Col 28, "This attribute is not valid for use on this language element")
]
// SOURCE=AttributeTargetsIsEnum01.fs # AttributeTargetsIsEnum01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsEnum01.fs"|])>]
let ``AttributeTargetsIsEnum01_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=AttributeTargetsIsEnum01.fs # AttributeTargetsIsEnum01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsEnum01.fs"|])>]
let ``AttributeTargetsIsEnum01_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsEnum01.fs # E_AttributeTargetIsEnum01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsEnum01.fs"|])>]
let ``E_AttributeTargetIsEnum01_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsEnum01.fs # E_AttributeTargetIsEnum01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsEnum01.fs"|])>]
let ``E_AttributeTargetIsEnum01_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 19, Col 3, Line 19, Col 15, "This attribute is not valid for use on this language element")
(Error 842, Line 20, Col 3, Line 20, Col 14, "This attribute is not valid for use on this language element")
(Error 842, Line 21, Col 3, Line 21, Col 18, "This attribute is not valid for use on this language element")
(Error 842, Line 22, Col 3, Line 22, Col 17, "This attribute is not valid for use on this language element")
]
// SOURCE=AttributeTargetsIsDelegate01.fs # AttributeTargetsIsDelegate01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsDelegate01.fs"|])>]
let ``AttributeTargetsIsDelegate01_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=AttributeTargetsIsDelegate01.fs # AttributeTargetsIsDelegate01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsDelegate01.fs"|])>]
let ``AttributeTargetsIsDelegate01_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsDelegate01.fs # E_AttributeTargetIsDelegate01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsDelegate01.fs"|])>]
let ``E_AttributeTargetIsDelegate01_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsDelegate01.fs # E_AttributeTargetIsDelegate01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsDelegate01.fs"|])>]
let ``E_AttributeTargetsIsDelegate01_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 19, Col 3, Line 19, Col 14, "This attribute is not valid for use on this language element")
(Error 842, Line 20, Col 3, Line 20, Col 15, "This attribute is not valid for use on this language element")
(Error 842, Line 21, Col 3, Line 21, Col 18, "This attribute is not valid for use on this language element")
(Error 842, Line 22, Col 3, Line 22, Col 13, "This attribute is not valid for use on this language element")
]
[<Fact>]
let ``Type-level let bindings allowed to use attribute with Field target`` () =
FSharp"""
module Foo
type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
[<VolatileField>]
let mutable valueFactory = valueFactory
"""
|> withLangVersionPreview
|> compile
|> shouldSucceed
// SOURCE=AttributeTargetsIsInterface.fs # AttributeTargetsIsInterface.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsInterface.fs"|])>]
let ``AttributeTargetsIsInterface_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=AttributeTargetsIsInterface.fs # AttributeTargetsIsInterface.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsInterface.fs"|])>]
let ``AttributeTargetsIsInterface_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsInterface.fs # E_AttributeTargetIsInterface.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsInterface.fs"|])>]
let ``E_AttributeTargetIsInterface_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsInterface.fs # E_AttributeTargetIsInterface.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsInterface.fs"|])>]
let ``E_AttributeTargetIsInterface_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 11, Col 3, Line 11, Col 14, "This attribute is not valid for use on this language element")
(Error 842, Line 14, Col 3, Line 14, Col 15, "This attribute is not valid for use on this language element")
(Error 842, Line 18, Col 3, Line 18, Col 14, "This attribute is not valid for use on this language element")
(Error 842, Line 19, Col 3, Line 19, Col 15, "This attribute is not valid for use on this language element")
]
// SOURCE= E_AttributeTargetIsClass02.fs # E_AttributeTargetIsClass02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass02.fs"|])>]
let ``E_AttributeTargetIsClass02_fs`` compilation =
compilation
|> verifyCompile
|> shouldSucceed
// SOURCE=E_AttributeTargetIsClass02.fs # E_AttributeTargetIsClass02.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass02.fs"|])>]
let ``E_AttributeTargetIsClass02_fs preview`` compilation =
compilation
|> withLangVersionPreview
|> verifyCompile
|> shouldFail
|> withDiagnostics [
(Error 842, Line 15, Col 3, Line 15, Col 18, "This attribute is not valid for use on this language element")
(Error 842, Line 16, Col 3, Line 16, Col 15, "This attribute is not valid for use on this language element")
(Error 842, Line 20, Col 3, Line 20, Col 14, "This attribute is not valid for use on this language element")
(Error 842, Line 21, Col 3, Line 21, Col 18, "This attribute is not valid for use on this language element")
]