Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove always-on InitPropertiesSupport language feature
The InitPropertiesSupport language feature was gated to F# 7.0 and is
effectively always enabled at the compiler's default language version.
Remove the feature flag entirely and collapse its single enforcement site
(CheckInitProperties) to the unconditional path, dropping the now-dead
TcGlobals argument. The init-only-property setter diagnostic still fires
unconditionally, so behavior is unchanged.

Fixes #20169

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
Copilot and Copilot committed Aug 24, 2026
commit 2c2720cde0c874146b104bbddc6b0729716ac179
11 changes: 5 additions & 6 deletions src/Compiler/Checking/Expressions/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1273,11 +1273,10 @@ let CheckForAbnormalOperatorNames (cenv: cenv) (idRange: range) coreDisplayName
warning(StandardOperatorRedefinitionWarning(FSComp.SR.tcInvalidMemberNameFixedTypes(RichText.mkOperator opName), idRange))
| Other -> ()

let CheckInitProperties (g: TcGlobals) (minfo: MethInfo) (methodName: string) mItem =
if g.langVersion.SupportsFeature(LanguageFeature.InitPropertiesSupport) then
// Check, whether this method has external init, emit an error diagnostic in this case.
if minfo.HasExternalInit then
errorR (Error(FSComp.SR.tcSetterForInitOnlyPropertyCannotBeCalled1 (RichText.mkProperty methodName), mItem))
let CheckInitProperties (minfo: MethInfo) (methodName: string) mItem =
// Check, whether this method has external init, emit an error diagnostic in this case.
if minfo.HasExternalInit then
errorR (Error(FSComp.SR.tcSetterForInitOnlyPropertyCannotBeCalled1 (RichText.mkProperty methodName), mItem))

let CheckRequiredProperties (g:TcGlobals) (env: TcEnv) (cenv: TcFileState) (minfo: MethInfo) finalAssignedItemSetters mMethExpr =
// Make sure, if apparent type has any required properties, they all are in the `finalAssignedItemSetters`.
Expand Down Expand Up @@ -10013,7 +10012,7 @@ and TcLookupItemThen cenv overallTy env tpenv mObjExpr objExpr objExprTy delayed
match minfos with
| minfo :: _ ->
// Check if we have properties with "init-only" setters, which we try to call after init is done.
CheckInitProperties g minfo methodName mItemIdent
CheckInitProperties minfo methodName mItemIdent
| _ -> ()

#if !NO_TYPEPROVIDERS
Expand Down
1 change: 0 additions & 1 deletion src/Compiler/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,6 @@ featureErrorOnDeprecatedRequireQualifiedAccess,"give error on deprecated access
featureInterfacesWithAbstractStaticMembers,"static abstract interface members"
featureSelfTypeConstraints,"self type constraints"
featureRequiredProperties,"support for required properties"
featureInitProperties,"support for consuming init properties"
featureLowercaseDUWhenRequireQualifiedAccess,"Allow lowercase DU when RequireQualifiedAccess attribute"
featureMatchNotAllowedForUnionCaseWithNoData,"Pattern match discard is not allowed for union case that takes no data."
featureCSharpExtensionAttributeNotRequired,"Allow implicit Extension attribute on declaring types, modules"
Expand Down
3 changes: 0 additions & 3 deletions src/Compiler/Facilities/LanguageFeatures.fs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type LanguageFeature =
| ReallyLongLists
| ErrorOnDeprecatedRequireQualifiedAccess
| RequiredPropertiesSupport
| InitPropertiesSupport
| LowercaseDUWhenRequireQualifiedAccess
| InterfacesWithAbstractStaticMembers
| SelfTypeConstraints
Expand Down Expand Up @@ -175,7 +174,6 @@ type LanguageVersion(versionText, ?disabledFeaturesArray: LanguageFeature array)
LanguageFeature.ReallyLongLists, languageVersion70
LanguageFeature.ErrorOnDeprecatedRequireQualifiedAccess, languageVersion70
LanguageFeature.RequiredPropertiesSupport, languageVersion70
LanguageFeature.InitPropertiesSupport, languageVersion70
LanguageFeature.LowercaseDUWhenRequireQualifiedAccess, languageVersion70
LanguageFeature.InterfacesWithAbstractStaticMembers, languageVersion70
LanguageFeature.SelfTypeConstraints, languageVersion70
Expand Down Expand Up @@ -381,7 +379,6 @@ type LanguageVersion(versionText, ?disabledFeaturesArray: LanguageFeature array)
| LanguageFeature.ReallyLongLists -> FSComp.SR.featureReallyLongList ()
| LanguageFeature.ErrorOnDeprecatedRequireQualifiedAccess -> FSComp.SR.featureErrorOnDeprecatedRequireQualifiedAccess ()
| LanguageFeature.RequiredPropertiesSupport -> FSComp.SR.featureRequiredProperties ()
| LanguageFeature.InitPropertiesSupport -> FSComp.SR.featureInitProperties ()
| LanguageFeature.LowercaseDUWhenRequireQualifiedAccess -> FSComp.SR.featureLowercaseDUWhenRequireQualifiedAccess ()
| LanguageFeature.InterfacesWithAbstractStaticMembers -> FSComp.SR.featureInterfacesWithAbstractStaticMembers ()
| LanguageFeature.SelfTypeConstraints -> FSComp.SR.featureSelfTypeConstraints ()
Expand Down
1 change: 0 additions & 1 deletion src/Compiler/Facilities/LanguageFeatures.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ type LanguageFeature =
| ReallyLongLists
| ErrorOnDeprecatedRequireQualifiedAccess
| RequiredPropertiesSupport
| InitPropertiesSupport
| LowercaseDUWhenRequireQualifiedAccess
| InterfacesWithAbstractStaticMembers
| SelfTypeConstraints
Expand Down
5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.zh-Hans.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions src/Compiler/xlf/FSComp.txt.zh-Hant.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading