From 3961b8e0f8f0ab2aeff6ac11154eddcb9e306ad4 Mon Sep 17 00:00:00 2001 From: Copilot Date: Fri, 28 Aug 2026 10:01:07 +0200 Subject: [PATCH] Remove always-on LanguageFeature.NameOf flag (#20153) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Compiler/Checking/CheckPatterns.fs | 3 +- .../Checking/Expressions/CheckExpressions.fs | 4 +- src/Compiler/Checking/NameResolution.fs | 30 ++------------ src/Compiler/Checking/NameResolution.fsi | 2 - src/Compiler/FSComp.txt | 3 +- src/Compiler/Facilities/LanguageFeatures.fs | 3 -- src/Compiler/Facilities/LanguageFeatures.fsi | 1 - .../TypedTree/TypedTreeOps.Transforms.fs | 2 +- src/Compiler/xlf/FSComp.txt.cs.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.de.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.es.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.fr.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.it.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.ja.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.ko.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.pl.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.ru.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.tr.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 9 +---- src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 9 +---- .../fsc/disableLanguageFeature.fs | 39 +------------------ 22 files changed, 36 insertions(+), 168 deletions(-) diff --git a/src/Compiler/Checking/CheckPatterns.fs b/src/Compiler/Checking/CheckPatterns.fs index 7ea6500dcfb..3bcd8576c45 100644 --- a/src/Compiler/Checking/CheckPatterns.fs +++ b/src/Compiler/Checking/CheckPatterns.fs @@ -628,8 +628,7 @@ and TcPatLongIdentNewDef warnOnUpperForId warnOnUpper (cenv: cenv) env ad valRep | [] -> TcPat warnOnUpperForId cenv env valReprInfo vFlags patEnv ty (mkSynPatVar vis id) - | [arg] - when g.langVersion.SupportsFeature LanguageFeature.NameOf && IsNameOf cenv env ad m id -> + | [arg] when IsNameOf cenv env ad m id -> match TcNameOfExpr cenv env tpenv (ConvSynPatToSynExpr arg) with | Expr.Const(Const.String s, m, _) -> // Record the resolution of the `nameof` usage so that we can classify it correctly later. diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index ff34ea0ae34..b6128ae6ed7 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -8990,7 +8990,7 @@ and TcApplicationThen (cenv: cenv) (overallTy: OverallTy) env tpenv mExprAndArg checkHighPrecedenceFunctionApplicationToList [synArg] atomicFlag mExprAndArg match leftExpr with - | ApplicableExpr(expr=NameOfExpr g _) when g.langVersion.SupportsFeature LanguageFeature.NameOf -> + | ApplicableExpr(expr=NameOfExpr g _) -> let replacementExpr = TcNameOfExpr cenv env tpenv synArg TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, replacementExpr, true, None)) g.string_ty ExprAtomicFlag.Atomic delayed | _ -> @@ -9726,7 +9726,7 @@ and TcValueItemThen cenv overallTy env vref tpenv mItem mItemIdent afterResoluti // - it isn't a VSlotDirectCall (uses of base values do not take type arguments // Allow `nameof<'T>` for a generic parameter match vref with - | _ when isNameOfValRef g vref && g.langVersion.SupportsFeature LanguageFeature.NameOf -> + | _ when isNameOfValRef g vref -> // Record the resolution of the `nameof` usage so that we can classify it correctly later. do match afterResolution with diff --git a/src/Compiler/Checking/NameResolution.fs b/src/Compiler/Checking/NameResolution.fs index e520c6235f6..e1fb1c437fb 100644 --- a/src/Compiler/Checking/NameResolution.fs +++ b/src/Compiler/Checking/NameResolution.fs @@ -60,7 +60,6 @@ type NameResolver(g: TcGlobals, member nr.g = g member nr.amap = amap member nr.InfoReader = infoReader - member nr.languageSupportsNameOf = g.langVersion.SupportsFeature LanguageFeature.NameOf //------------------------------------------------------------------------- // Helpers for unionconstrs and recdfields @@ -3468,15 +3467,6 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified let lookupKind = LookupKind.Expr LookupIsInstance.No - let canSuggestThisItem (item:Item) = - // All items can be suggested except nameof when it comes from FSharp.Core.dll and the nameof feature is not enabled - match item with - | Item.Value v -> - let isNameOfOperator = valRefEq ncenv.g ncenv.g.nameof_vref v - if isNameOfOperator && not (ncenv.g.langVersion.SupportsFeature LanguageFeature.NameOf) then false - else true - | _ -> true - if first && id.idText = MangledGlobalName then match rest with | [] -> @@ -3515,15 +3505,7 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified | true, res -> let fresh = ResolveUnqualifiedItem ncenv nenv m res - match fresh with - | Item.Value value -> - let isNameOfOperator = valRefEq ncenv.g ncenv.g.nameof_vref value - if isNameOfOperator && not ncenv.languageSupportsNameOf then - // Do not resolve `nameof` if the feature is unsupported, even if it is FSharp.Core - None - else - Some (emptyEnclosingTypeInst, fresh, rest) - | _ -> Some (emptyEnclosingTypeInst, fresh, rest) + Some (emptyEnclosingTypeInst, fresh, rest) | _ -> None @@ -3574,8 +3556,7 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified let suggestNamesAndTypes (addToBuffer: string -> unit) = for e in nenv.eUnqualifiedItems do - if canSuggestThisItem e.Value then - addToBuffer e.Value.DisplayName + addToBuffer e.Value.DisplayName for e in nenv.TyconsByDemangledNameAndArity fullyQualified do if IsEntityAccessible ncenv.amap m ad e.Value then @@ -3671,8 +3652,7 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified addToBuffer tcref.DisplayName for KeyValue(_,item) in nenv.eUnqualifiedItems do - if canSuggestThisItem item then - addToBuffer item.DisplayName + addToBuffer item.DisplayName match innerSearch with | Exception (UndefinedName(0, _, id1, suggestionsF)) when equals id.idRange id1.idRange -> @@ -4739,9 +4719,7 @@ let IsUnionCaseUnseen ad g amap m allowObsolete (ucref: UnionCaseRef) = let ItemIsUnseen ad g amap m allowObsolete item = match item with - | Item.Value x -> - let isUnseenNameOfOperator = valRefEq g g.nameof_vref x && not (g.langVersion.SupportsFeature LanguageFeature.NameOf) - isUnseenNameOfOperator || IsValUnseen ad g m allowObsolete x + | Item.Value x -> IsValUnseen ad g m allowObsolete x | Item.UnionCase(x, _) -> IsUnionCaseUnseen ad g amap m allowObsolete x.UnionCaseRef | Item.ExnCase x -> IsTyconUnseen ad g amap m allowObsolete x | Item.ILField finfo -> not allowObsolete && ILFieldInfoIsUnseen finfo diff --git a/src/Compiler/Checking/NameResolution.fsi b/src/Compiler/Checking/NameResolution.fsi index 3b37e4fdcbf..d7da7bf16fa 100755 --- a/src/Compiler/Checking/NameResolution.fsi +++ b/src/Compiler/Checking/NameResolution.fsi @@ -30,8 +30,6 @@ type NameResolver = member g: TcGlobals - member languageSupportsNameOf: bool - /// Get the active pattern elements defined in a module, if any. Cache in the slot in the module type. val ActivePatternElemsOfModuleOrNamespace: g: TcGlobals -> ModuleOrNamespaceRef -> NameMap diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 29d13df0cd0..4202ead64f0 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1559,7 +1559,6 @@ optsAlwaysInline,"Always inline 'inline' functions" nativeResourceFormatError,"Stream does not begin with a null resource and is not in '.RES' format." nativeResourceHeaderMalformed,"Resource header beginning at offset %s is malformed." formatDashItem," - %s" -featureNameOf,"nameof" featureDotlessFloat32Literal,"dotless float32 literal" featurePackageManagement,"package management" featureFromEndSlicing,"from-end slicing" @@ -1788,7 +1787,7 @@ featurePreprocessorElif,"#elif preprocessor directive" featureExtensionConstraintSolutions,"Allow extension members to participate in SRTP constraint resolution" featureErrorOnBitwiseOpsOnNonIntegralEnums,"Error when bitwise operators are used on enums whose underlying type is not an integer type (e.g. char)." 3880,optsLangVersionOutOfSupport,"Language version '%s' is out of support. The last .NET SDK supporting it is available at https://dotnet.microsoft.com/en-us/download/dotnet/%s" -3881,optsUnrecognizedLanguageFeature,"Unrecognized language feature name: '%s'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'." +3881,optsUnrecognizedLanguageFeature,"Unrecognized language feature name: '%s'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'." 3882,lexHashElifMustBeFirst,"#elif directive must appear as the first non-whitespace character on a line" 3883,lexHashElifMustHaveIdent,"#elif directive should be immediately followed by an identifier" 3884,tcFunctionValueUsedAsInterpolatedStringArg,"This expression is a function value. When used in an interpolated string it will be formatted using its 'ToString' method, which is likely not the intended behavior. Consider applying the function to its arguments." diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index 97239a6a940..f944d2ac9cc 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -16,7 +16,6 @@ module internal FSharp.Compiler.Features [] type LanguageFeature = - | NameOf | DotlessFloat32Literal | PackageManagement | FromEndSlicing @@ -142,7 +141,6 @@ type LanguageVersion(versionText, ?disabledFeaturesArray: LanguageFeature array) LanguageFeature.DefaultInterfaceMemberConsumption, languageVersion50 LanguageFeature.PackageManagement, languageVersion50 LanguageFeature.WitnessPassing, languageVersion50 - LanguageFeature.NameOf, languageVersion50 LanguageFeature.StringInterpolation, languageVersion50 // F# 6.0 @@ -328,7 +326,6 @@ type LanguageVersion(versionText, ?disabledFeaturesArray: LanguageFeature array) /// Get a string name for the given feature. static member GetFeatureString feature = match feature with - | LanguageFeature.NameOf -> FSComp.SR.featureNameOf () | LanguageFeature.DotlessFloat32Literal -> FSComp.SR.featureDotlessFloat32Literal () | LanguageFeature.PackageManagement -> FSComp.SR.featurePackageManagement () | LanguageFeature.FromEndSlicing -> FSComp.SR.featureFromEndSlicing () diff --git a/src/Compiler/Facilities/LanguageFeatures.fsi b/src/Compiler/Facilities/LanguageFeatures.fsi index 931629eebcd..25b9f4a1397 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fsi +++ b/src/Compiler/Facilities/LanguageFeatures.fsi @@ -6,7 +6,6 @@ module internal FSharp.Compiler.Features /// LanguageFeature enumeration [] type LanguageFeature = - | NameOf | DotlessFloat32Literal | PackageManagement | FromEndSlicing diff --git a/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs b/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs index 55e8e71b3f2..5560e997073 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.Transforms.fs @@ -2351,7 +2351,7 @@ module internal ConstantEvaluation = | UncheckedDefaultOfExpr g _ | SizeOfExpr g _ | TypeOfExpr g _ -> true - | NameOfExpr g _ when g.langVersion.SupportsFeature LanguageFeature.NameOf -> true + | NameOfExpr g _ -> true // All others are not simple constant expressions | _ -> false diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 7758bfff93f..e7dd17ed48d 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format Řetězcové hodnoty označené jako literály a konstanty IL jako formát printf @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 08ca8cb9ebd..3a292bcfd22 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format Zeichenfolgenwerte, die als Literale und IL-Konstanten als printf-Format markiert sind @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 71a3e2db55c..1958ee68855 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format Valores de cadena marcados como literales y constantes IL como formato printf @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index d88803dec60..75897b6b2c4 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format Valeurs de chaîne marquées comme littéraux et constantes IL au format printf @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 6e206a88f36..f42810813b4 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format Valori stringa contrassegnati come valori letterali e costanti IL come formato printf @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 3baa0fd6e17..6f214a7dec1 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format リテラルとしてマークされた文字列値およびprintf 形式としてマークされた IL 定数 @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index bf2b4a248e7..32a8d556f5d 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format 리터럴로 표시된 문자열 값과 printf 형식으로 표시된 IL 상수 @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 76542364493..0b248f4d770 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format Wartości ciągów oznaczone jako literały i stałe IL jako format printf @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 1f1f5391694..86d70029faa 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format Valores de cadeia de caracteres marcados como literais e constantes IL como formato printf @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 43fdc52908d..555604a4f7f 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format Значения строк, помеченные как литералы, и константы IL в формате printf @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 969330f4833..239024155d9 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format Sabit değer olarak işaretlenen dize değerleri ve printf biçimi olarak IL sabitleri @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index d846fb3af03..a1463c5e41d 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format 标记为文本和 IL 常量的字符串值为 printf 格式 @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 273d94dcc27..6a134ef3f3b 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -507,11 +507,6 @@ Use 'most concrete' tiebreaker for overload resolution when methods differ only by type parameter concreteness. - - nameof - nameof - - String values marked as literals and IL constants as printf format 標記為常值的字串值和標記為 printf 格式的 IL 常數 @@ -1093,8 +1088,8 @@ - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. - Unrecognized language feature name: '{0}'. Use a valid feature name such as 'NameOf' or 'StringInterpolation'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. + Unrecognized language feature name: '{0}'. Use a valid feature name such as 'StringInterpolation' or 'FromEndSlicing'. diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/disableLanguageFeature.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/disableLanguageFeature.fs index 2f19a290c77..e81ee61dcbe 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/disableLanguageFeature.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/disableLanguageFeature.fs @@ -13,24 +13,11 @@ module disableLanguageFeature = FSharp """ printfn "Hello, World" """ - |> withOptions ["--disableLanguageFeature:NameOf"] + |> withOptions ["--disableLanguageFeature:StringInterpolation"] |> typecheck |> shouldSucceed |> ignore - [] - let ``disableLanguageFeature should disable NameOf feature``() = - // nameof with type parameter requires LanguageFeature.NameOf - FSharp """ -let f<'T>() = nameof<'T> - """ - |> withOptions ["--langversion:latest"; "--disableLanguageFeature:NameOf"] - |> typecheck - |> shouldFail - |> withErrorCode 39 - |> withDiagnosticMessageMatches "The value or constructor 'nameof' is not defined" - |> ignore - [] let ``disableLanguageFeature with invalid feature name should fail``() = FSharp """ @@ -42,27 +29,3 @@ printfn "Hello, World" |> withErrorCode 3881 |> withDiagnosticMessageMatches "Unrecognized language feature name" |> ignore - - [] - let ``disableLanguageFeature can be used multiple times``() = - // nameof with type parameter requires LanguageFeature.NameOf - FSharp """ -let f<'T>() = nameof<'T> - """ - |> withOptions ["--langversion:latest"; "--disableLanguageFeature:NameOf"; "--disableLanguageFeature:StringInterpolation"] - |> typecheck - |> shouldFail - |> withErrorCode 39 - |> ignore - - [] - let ``disableLanguageFeature is case insensitive``() = - // nameof with type parameter requires LanguageFeature.NameOf - FSharp """ -let f<'T>() = nameof<'T> - """ - |> withOptions ["--langversion:latest"; "--disableLanguageFeature:nameof"] - |> typecheck - |> shouldFail - |> withErrorCode 39 - |> ignore