Skip to content

Commit 767b5ec

Browse files
authored
reenable attribute usage (#17763)
1 parent 8d04015 commit 767b5ec

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

src/Compiler/Facilities/LanguageFeatures.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ type LanguageVersion(versionText) =
212212
LanguageFeature.LowerSimpleMappingsInComprehensionsToFastLoops, languageVersion90
213213
LanguageFeature.ParsedHashDirectiveArgumentNonQuotes, languageVersion90
214214
LanguageFeature.EmptyBodiedComputationExpressions, languageVersion90
215+
LanguageFeature.EnforceAttributeTargets, languageVersion90
215216

216217
// F# preview
217-
LanguageFeature.EnforceAttributeTargets, previewVersion // waiting for fix of https://github.com/dotnet/fsharp/issues/17731
218218
LanguageFeature.UnmanagedConstraintCsharpInterop, previewVersion // not enabled because: https://github.com/dotnet/fsharp/issues/17509
219219
LanguageFeature.FromEndSlicing, previewVersion // Unfinished features --- needs work
220220
LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters, previewVersion

tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs

+31-31
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ module CustomAttributes_AttributeUsage =
9898
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargets01.fs"|])>]
9999
let ``E_AttributeTargets01_fs`` compilation =
100100
compilation
101-
|> withLangVersionPreview
101+
|> withLangVersion90
102102
|> verifyCompile
103103
|> shouldFail
104104
|> withDiagnostics [
@@ -134,7 +134,7 @@ module CustomAttributes_AttributeUsage =
134134
let ``E_AttributeTargetIsField01_fs`` compilation =
135135
compilation
136136
|> withOptions ["--nowarn:25"]
137-
|> withLangVersionPreview
137+
|> withLangVersion90
138138
|> verifyCompile
139139
|> shouldFail
140140
|> withDiagnostics [
@@ -187,7 +187,7 @@ module CustomAttributes_AttributeUsage =
187187
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsMethod02.fs"|])>]
188188
let ``E_AttributeTargetIsMethod02_fs`` compilation =
189189
compilation
190-
|> withLangVersionPreview
190+
|> withLangVersion90
191191
|> withOptions ["--nowarn:25"]
192192
|> verifyCompile
193193
|> shouldFail
@@ -218,7 +218,7 @@ module CustomAttributes_AttributeUsage =
218218
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsMethod03.fs"|])>]
219219
let ``E_AttributeTargetIsMethod03_fs`` compilation =
220220
compilation
221-
|> withLangVersionPreview
221+
|> withLangVersion90
222222
|> withOptions ["--nowarn:25"]
223223
|> verifyCompile
224224
|> shouldFail
@@ -336,7 +336,7 @@ module CustomAttributes_AttributeUsage =
336336
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsStruct.fs"|])>]
337337
let ``E_AttributeTargetIsStruct_fs`` compilation =
338338
compilation
339-
|> withLangVersionPreview
339+
|> withLangVersion90
340340
|> verifyCompile
341341
|> shouldFail
342342
|> withDiagnostics [
@@ -366,7 +366,7 @@ module CustomAttributes_AttributeUsage =
366366
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass.fs"|])>]
367367
let ``E_AttributeTargetIsClass_fs`` compilation =
368368
compilation
369-
|> withLangVersionPreview
369+
|> withLangVersion90
370370
|> verifyCompile
371371
|> shouldFail
372372
|> withDiagnostics [
@@ -387,7 +387,7 @@ module CustomAttributes_AttributeUsage =
387387
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass01.fs"|])>]
388388
let ``E_AttributeTargetIsClass01_fs`` compilation =
389389
compilation
390-
|> withLangVersionPreview
390+
|> withLangVersion90
391391
|> verifyCompile
392392
|> shouldFail
393393
|> withDiagnostics [
@@ -485,7 +485,7 @@ module CustomAttributes_AttributeUsage =
485485
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsField03.fs"|])>]
486486
let ``E_AttributeTargetIsField03_fs`` compilation =
487487
compilation
488-
|> withLangVersionPreview
488+
|> withLangVersion90
489489
|> verifyCompile
490490
|> shouldFail
491491
|> withDiagnostics [
@@ -505,7 +505,7 @@ module CustomAttributes_AttributeUsage =
505505
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsProperty01.fs"|])>]
506506
let ``E_AttributeTargetIsProperty01_fs`` compilation =
507507
compilation
508-
|> withLangVersionPreview
508+
|> withLangVersion90
509509
|> verifyCompile
510510
|> shouldFail
511511
|> withDiagnostics [
@@ -525,7 +525,7 @@ module CustomAttributes_AttributeUsage =
525525
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsCtor01.fs"|])>]
526526
let ``E_AttributeTargetIsCtor01_fs`` compilation =
527527
compilation
528-
|> withLangVersionPreview
528+
|> withLangVersion90
529529
|> verifyCompile
530530
|> shouldFail
531531
|> withDiagnostics [
@@ -562,7 +562,7 @@ module CustomAttributes_AttributeUsage =
562562
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsEnum01.fs"|])>]
563563
let ``E_AttributeTargetIsEnum01_fs`` compilation =
564564
compilation
565-
|> withLangVersionPreview
565+
|> withLangVersion90
566566
|> verifyCompile
567567
|> shouldFail
568568
|> withDiagnostics [
@@ -599,7 +599,7 @@ module CustomAttributes_AttributeUsage =
599599
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsDelegate01.fs"|])>]
600600
let ``E_AttributeTargetsIsDelegate01_fs`` compilation =
601601
compilation
602-
|> withLangVersionPreview
602+
|> withLangVersion90
603603
|> verifyCompile
604604
|> shouldFail
605605
|> withDiagnostics [
@@ -648,7 +648,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
648648
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsInterface.fs"|])>]
649649
let ``E_AttributeTargetIsInterface_fs`` compilation =
650650
compilation
651-
|> withLangVersionPreview
651+
|> withLangVersion90
652652
|> verifyCompile
653653
|> shouldFail
654654
|> withDiagnostics [
@@ -670,7 +670,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
670670
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AttributeTargetIsClass02.fs"|])>]
671671
let ``E_AttributeTargetIsClass02_fs`` compilation =
672672
compilation
673-
|> withLangVersionPreview
673+
|> withLangVersion90
674674
|> verifyCompile
675675
|> shouldFail
676676
|> withDiagnostics [
@@ -698,9 +698,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
698698

699699
// SOURCE=CLIMutableAttribute01.fs # CLIMutableAttribute01.fs
700700
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"CLIMutableAttribute01.fs"|])>]
701-
let ``CLIMutableAttribute01 preview`` compilation =
701+
let ``CLIMutableAttribute01 90`` compilation =
702702
compilation
703-
|> withLangVersionPreview
703+
|> withLangVersion90
704704
|> verifyCompile
705705
|> shouldSucceed
706706

@@ -724,9 +724,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
724724

725725
// SOURCE=E_CLIMutableAttribute.fs # E_CLIMutableAttribute.fs
726726
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_CLIMutableAttribute.fs"|])>]
727-
let ``E_CLIMutableAttribute preview`` compilation =
727+
let ``E_CLIMutableAttribute 90`` compilation =
728728
compilation
729-
|> withLangVersionPreview
729+
|> withLangVersion90
730730
|> verifyCompile
731731
|> shouldFail
732732
|> withDiagnostics [
@@ -761,9 +761,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
761761

762762
// SOURCE=E_AllowNullLiteral.fs # E_AllowNullLiteral.fs
763763
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_AllowNullLiteral.fs"|])>]
764-
let ``E_AllowNullLiteral preview`` compilation =
764+
let ``E_AllowNullLiteral 90`` compilation =
765765
compilation
766-
|> withLangVersionPreview
766+
|> withLangVersion90
767767
|> verifyCompile
768768
|> shouldFail
769769
|> withDiagnostics [
@@ -788,9 +788,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
788788

789789
// SOURCE=AllowNullLiteral01.fs # AllowNullLiteral01.fs
790790
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AllowNullLiteral01.fs"|])>]
791-
let ``AllowNullLiteral01 preview`` compilation =
791+
let ``AllowNullLiteral01 90`` compilation =
792792
compilation
793-
|> withLangVersionPreview
793+
|> withLangVersion90
794794
|> verifyCompile
795795
|> shouldSucceed
796796

@@ -816,9 +816,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
816816

817817
// SOURCE=E_VolatileField.fs # E_VolatileField.fs
818818
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_VolatileField.fs"|])>]
819-
let ``E_VolatileField preview`` compilation =
819+
let ``E_VolatileField 90`` compilation =
820820
compilation
821-
|> withLangVersionPreview
821+
|> withLangVersion90
822822
|> verifyCompile
823823
|> shouldFail
824824
|> withDiagnostics [
@@ -844,9 +844,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
844844

845845
// SOURCE=VolatileField01.fs # VolatileField01.fs
846846
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"VolatileField01.fs"|])>]
847-
let ``VolatileField01 preview`` compilation =
847+
let ``VolatileField01 90`` compilation =
848848
compilation
849-
|> withLangVersionPreview
849+
|> withLangVersion90
850850
|> verifyCompile
851851
|> shouldSucceed
852852

@@ -865,9 +865,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
865865

866866
// SOURCE=E_SealedAttribute01.fs # E_SealedAttribute01.fs
867867
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_SealedAttribute01.fs"|])>]
868-
let ``E_SealedAttribute01 preview`` compilation =
868+
let ``E_SealedAttribute01 90`` compilation =
869869
compilation
870-
|> withLangVersionPreview
870+
|> withLangVersion90
871871
|> verifyCompile
872872
|> shouldFail
873873
|> withDiagnostics [
@@ -893,9 +893,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) =
893893

894894
// SOURCE=E_StructLayout01.fs # E_StructLayout01.fs
895895
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_StructLayout01.fs"|])>]
896-
let ``E_StructLayout01 preview`` compilation =
896+
let ``E_StructLayout01 90`` compilation =
897897
compilation
898-
|> withLangVersionPreview
898+
|> withLangVersion90
899899
|> verifyCompile
900900
|> shouldFail
901901
|> withDiagnostics [
@@ -925,7 +925,7 @@ and [<ApplicationTenantJsonDerivedType>]
925925
"""
926926

927927
[<InlineData("8.0")>]
928-
[<InlineData("preview")>]
928+
[<InlineData("9.0")>]
929929
[<Theory>]
930930
let ``Regression for - F# 9 compiler cannot find constructor for attribute`` langVersion =
931931
FSharp missingConstructorRepro

0 commit comments

Comments
 (0)