From 0ddbed61ee224725498337e40a3a682126e9f911 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Mon, 5 Dec 2022 16:21:00 +0100 Subject: [PATCH 1/4] Fix a broken debug assertion that kicked in whenever building Fsharp.Core in Debug --- src/Compiler/Checking/CheckExpressions.fs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 53381d07648..918890aa8e6 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -2204,7 +2204,7 @@ module GeneralizationHelpers = // ComputeInlineFlag //------------------------------------------------------------------------- -let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable hasNoCompilerInliningAttribute m = +let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable enforceNoInlining m = let inlineFlag = let isCtorOrAbstractSlot = match memFlagsOption with @@ -2215,7 +2215,7 @@ let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable // Constructors may never be inlined // Calls to virtual/abstract slots may never be inlined // Values marked with NoCompilerInliningAttribute may never be inlined - if isMutable || isCtorOrAbstractSlot || hasNoCompilerInliningAttribute then + if isMutable || isCtorOrAbstractSlot || enforceNoInlining then ValInline.Never elif isInline then ValInline.Always @@ -12042,6 +12042,12 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind let attrs = TcAttributes cenv env attrTgt synAttrs let newOk = if canInferTypars then NewTyparsOK else NoNewTypars let hasNoCompilerInliningAttribute = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute attrs + let hasMethodImplNoInlining = + match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with + // NO_INLINING = 8 + | Some (Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> (flags &&& 0x8) <> 0x0 + | _ -> false + let forceDoNotInline = hasNoCompilerInliningAttribute || hasMethodImplNoInlining let valinfos, tpenv = TcValSpec cenv env declKind newOk containerInfo memFlagsOpt None tpenv synValSig attrs let denv = env.DisplayEnv @@ -12050,7 +12056,7 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind let (ValSpecResult (altActualParent, memberInfoOpt, id, enclosingDeclaredTypars, declaredTypars, ty, prelimValReprInfo, declKind)) = valSpecResult - let inlineFlag = ComputeInlineFlag (memberInfoOpt |> Option.map (fun (PrelimMemberInfo(memberInfo, _, _)) -> memberInfo.MemberFlags)) isInline mutableFlag hasNoCompilerInliningAttribute m + let inlineFlag = ComputeInlineFlag (memberInfoOpt |> Option.map (fun (PrelimMemberInfo(memberInfo, _, _)) -> memberInfo.MemberFlags)) isInline mutableFlag forceDoNotInline m let freeInType = freeInTypeLeftToRight g false ty From 04ace513d4ab5c13a85935a6797b31e7aa9cfb96 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 6 Dec 2022 12:24:06 +0100 Subject: [PATCH 2/4] All places reflected to respect NoInline --- src/Compiler/Checking/CheckExpressions.fs | 33 +++++++++++------------ 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 918890aa8e6..a6c8dd1c1f3 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -2204,7 +2204,16 @@ module GeneralizationHelpers = // ComputeInlineFlag //------------------------------------------------------------------------- -let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable enforceNoInlining m = +let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable g attrs m = + let hasNoCompilerInliningAttribute() = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute attrs + let hasMethodImplNoInlining() = + match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with + // NO_INLINING = 8 + | Some (Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> (flags &&& 0x8) <> 0x0 + | _ -> false + let enforceNoInlining() = hasNoCompilerInliningAttribute() || hasMethodImplNoInlining() + + let inlineFlag = let isCtorOrAbstractSlot = match memFlagsOption with @@ -2215,7 +2224,7 @@ let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable // Constructors may never be inlined // Calls to virtual/abstract slots may never be inlined // Values marked with NoCompilerInliningAttribute may never be inlined - if isMutable || isCtorOrAbstractSlot || enforceNoInlining then + if isMutable || isCtorOrAbstractSlot || enforceNoInlining() then ValInline.Never elif isInline then ValInline.Always @@ -10286,10 +10295,8 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt SynValData(valMf, SynValInfo(args, SynArgInfo({Attributes=rotRetSynAttrs; Range=mHead} :: attrs, opt, retId)), valId) retAttribs, valAttribs, valSynData - let isVolatile = HasFSharpAttribute g g.attrib_VolatileFieldAttribute valAttribs - let hasNoCompilerInliningAttribute = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute valAttribs - - let inlineFlag = ComputeInlineFlag memberFlagsOpt isInline isMutable hasNoCompilerInliningAttribute mBinding + let isVolatile = HasFSharpAttribute g g.attrib_VolatileFieldAttribute valAttribs + let inlineFlag = ComputeInlineFlag memberFlagsOpt isInline isMutable g valAttribs mBinding let argAttribs = spatsL |> List.map (SynInfo.InferSynArgInfoFromSimplePats >> List.map (SynInfo.AttribsOfArgData >> TcAttrs AttributeTargets.Parameter false)) @@ -11422,10 +11429,9 @@ and AnalyzeAndMakeAndPublishRecursiveValue let bindingAttribs = TcAttributes cenv env attrTgt bindingSynAttribs // Allocate the type inference variable for the inferred type - let ty = NewInferenceType g - let hasNoCompilerInliningAttribute = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute bindingAttribs + let ty = NewInferenceType g - let inlineFlag = ComputeInlineFlag memberFlagsOpt isInline isMutable hasNoCompilerInliningAttribute mBinding + let inlineFlag = ComputeInlineFlag memberFlagsOpt isInline isMutable g bindingAttribs mBinding if isMutable then errorR(Error(FSComp.SR.tcOnlyRecordFieldsAndSimpleLetCanBeMutable(), mBinding)) @@ -12041,13 +12047,6 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind let attrs = TcAttributes cenv env attrTgt synAttrs let newOk = if canInferTypars then NewTyparsOK else NoNewTypars - let hasNoCompilerInliningAttribute = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute attrs - let hasMethodImplNoInlining = - match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with - // NO_INLINING = 8 - | Some (Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> (flags &&& 0x8) <> 0x0 - | _ -> false - let forceDoNotInline = hasNoCompilerInliningAttribute || hasMethodImplNoInlining let valinfos, tpenv = TcValSpec cenv env declKind newOk containerInfo memFlagsOpt None tpenv synValSig attrs let denv = env.DisplayEnv @@ -12056,7 +12055,7 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind let (ValSpecResult (altActualParent, memberInfoOpt, id, enclosingDeclaredTypars, declaredTypars, ty, prelimValReprInfo, declKind)) = valSpecResult - let inlineFlag = ComputeInlineFlag (memberInfoOpt |> Option.map (fun (PrelimMemberInfo(memberInfo, _, _)) -> memberInfo.MemberFlags)) isInline mutableFlag forceDoNotInline m + let inlineFlag = ComputeInlineFlag (memberInfoOpt |> Option.map (fun (PrelimMemberInfo(memberInfo, _, _)) -> memberInfo.MemberFlags)) isInline mutableFlag g attrs m let freeInType = freeInTypeLeftToRight g false ty From 4cd05dce031fc34d1d66a84e86b8b4e849219953 Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 6 Dec 2022 12:32:38 +0100 Subject: [PATCH 3/4] HasMethodImplNoInliningAttribute unification --- src/Compiler/Checking/CheckExpressions.fs | 28 +++++++++-------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index a6c8dd1c1f3..21e9b2fb0f5 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -1209,6 +1209,12 @@ let CheckRequiredProperties (g:TcGlobals) (env: TcEnv) (cenv: TcFileState) (minf let details = NicePrint.multiLineStringOfPropInfos g cenv.amap mMethExpr env.DisplayEnv missingProps errorR(Error(FSComp.SR.tcMissingRequiredMembers details, mMethExpr)) +let private HasMethodImplNoInliningAttribute g attrs = + match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with + // NO_INLINING = 8 + | Some (Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> (flags &&& 0x8) <> 0x0 + | _ -> false + let MakeAndPublishVal (cenv: cenv) env (altActualParent, inSig, declKind, valRecInfo, vscheme, attrs, xmlDoc, konst, isGeneratedEventVal) = let g = cenv.g @@ -1257,16 +1263,10 @@ let MakeAndPublishVal (cenv: cenv) env (altActualParent, inSig, declKind, valRec errorR(Error(FSComp.SR.tcDllImportStubsCannotBeInlined(), m)) ValInline.Never else - let implflags = - match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with - | Some (Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> flags - | _ -> 0x0 - // MethodImplOptions.NoInlining = 0x8 - let NO_INLINING = 0x8 - if (implflags &&& NO_INLINING) <> 0x0 then - ValInline.Never - else - inlineFlag + if HasMethodImplNoInliningAttribute g attrs + then ValInline.Never + else inlineFlag + // CompiledName not allowed on virtual/abstract/override members let compiledNameAttrib = TryFindFSharpStringAttribute g g.attrib_CompiledNameAttribute attrs @@ -2206,13 +2206,7 @@ module GeneralizationHelpers = let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable g attrs m = let hasNoCompilerInliningAttribute() = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute attrs - let hasMethodImplNoInlining() = - match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with - // NO_INLINING = 8 - | Some (Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> (flags &&& 0x8) <> 0x0 - | _ -> false - let enforceNoInlining() = hasNoCompilerInliningAttribute() || hasMethodImplNoInlining() - + let enforceNoInlining() = hasNoCompilerInliningAttribute() || HasMethodImplNoInliningAttribute g attrs let inlineFlag = let isCtorOrAbstractSlot = From 6a8a9bea022284e4aaf31a6f801aca9279b5110d Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Tue, 6 Dec 2022 14:53:01 +0100 Subject: [PATCH 4/4] Hiding an (old) warning in a new situation behind a new lang feature --- src/Compiler/Checking/CheckExpressions.fs | 31 ++++++++++--------- src/Compiler/FSComp.txt | 1 + src/Compiler/Facilities/LanguageFeatures.fs | 3 ++ src/Compiler/Facilities/LanguageFeatures.fsi | 1 + src/Compiler/xlf/FSComp.txt.cs.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.de.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.es.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.fr.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.it.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.ja.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.ko.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.pl.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.pt-BR.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.ru.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.tr.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.zh-Hans.xlf | 5 +++ src/Compiler/xlf/FSComp.txt.zh-Hant.xlf | 5 +++ ...dImplAttribute.NoInlining_InlineKeyword.fs | 3 ++ .../MethodImplAttribute.fs | 14 +++++++++ tests/FSharp.Test.Utilities/Compiler.fs | 3 ++ 20 files changed, 107 insertions(+), 14 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining_InlineKeyword.fs diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 21e9b2fb0f5..2faaa9cfc46 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -2205,28 +2205,31 @@ module GeneralizationHelpers = //------------------------------------------------------------------------- let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable g attrs m = - let hasNoCompilerInliningAttribute() = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute attrs - let enforceNoInlining() = hasNoCompilerInliningAttribute() || HasMethodImplNoInliningAttribute g attrs - - let inlineFlag = - let isCtorOrAbstractSlot = - match memFlagsOption with - | None -> false - | Some x -> (x.MemberKind = SynMemberKind.Constructor) || x.IsDispatchSlot || x.IsOverrideOrExplicitImpl + let hasNoCompilerInliningAttribute() = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute attrs + let isCtorOrAbstractSlot() = + match memFlagsOption with + | None -> false + | Some x -> (x.MemberKind = SynMemberKind.Constructor) || x.IsDispatchSlot || x.IsOverrideOrExplicitImpl + let inlineFlag, reportIncorrectInlineKeywordUsage = // Mutable values may never be inlined // Constructors may never be inlined // Calls to virtual/abstract slots may never be inlined - // Values marked with NoCompilerInliningAttribute may never be inlined - if isMutable || isCtorOrAbstractSlot || enforceNoInlining() then - ValInline.Never + // Values marked with NoCompilerInliningAttribute or [] may never be inlined + if isMutable || isCtorOrAbstractSlot() || hasNoCompilerInliningAttribute() then + ValInline.Never, errorR + elif HasMethodImplNoInliningAttribute g attrs then + ValInline.Never, + if g.langVersion.SupportsFeature LanguageFeature.WarningWhenInliningMethodImplNoInlineMarkedFunction + then warning + else ignore elif isInline then - ValInline.Always + ValInline.Always, ignore else - ValInline.Optional + ValInline.Optional, ignore if isInline && (inlineFlag <> ValInline.Always) then - errorR(Error(FSComp.SR.tcThisValueMayNotBeInlined(), m)) + reportIncorrectInlineKeywordUsage (Error(FSComp.SR.tcThisValueMayNotBeInlined(), m)) inlineFlag diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 1c3623d2a1f..9066d2ef545 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1558,6 +1558,7 @@ featureLowercaseDUWhenRequireQualifiedAccess,"Allow lowercase DU when RequireQua featureMatchNotAllowedForUnionCaseWithNoData,"Pattern match discard is not allowed for union case that takes no data." featureCSharpExtensionAttributeNotRequired,"Allow implicit Extension attribute on declaring types, modules" featureErrorForNonVirtualMembersOverrides,"Raises errors for non-virtual members overrides" +featureWarningWhenInliningMethodImplNoInlineMarkedFunction,"Raises warnings when 'let inline ... =' is used together with [] attribute. Function is not getting inlined." 3353,fsiInvalidDirective,"Invalid directive '#%s %s'" 3354,tcNotAFunctionButIndexerNamedIndexingNotYetEnabled,"This value supports indexing, e.g. '%s.[index]'. The syntax '%s[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." 3354,tcNotAFunctionButIndexerIndexingNotYetEnabled,"This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index 14302b05132..d96c351d820 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -57,6 +57,7 @@ type LanguageFeature = | MatchNotAllowedForUnionCaseWithNoData | CSharpExtensionAttributeNotRequired | ErrorForNonVirtualMembersOverrides + | WarningWhenInliningMethodImplNoInlineMarkedFunction /// LanguageVersion management type LanguageVersion(versionText) = @@ -130,6 +131,7 @@ type LanguageVersion(versionText) = LanguageFeature.MatchNotAllowedForUnionCaseWithNoData, previewVersion LanguageFeature.CSharpExtensionAttributeNotRequired, previewVersion LanguageFeature.ErrorForNonVirtualMembersOverrides, previewVersion + LanguageFeature.WarningWhenInliningMethodImplNoInlineMarkedFunction, previewVersion ] @@ -240,6 +242,7 @@ type LanguageVersion(versionText) = | LanguageFeature.MatchNotAllowedForUnionCaseWithNoData -> FSComp.SR.featureMatchNotAllowedForUnionCaseWithNoData () | LanguageFeature.CSharpExtensionAttributeNotRequired -> FSComp.SR.featureCSharpExtensionAttributeNotRequired () | LanguageFeature.ErrorForNonVirtualMembersOverrides -> FSComp.SR.featureErrorForNonVirtualMembersOverrides () + | LanguageFeature.WarningWhenInliningMethodImplNoInlineMarkedFunction -> FSComp.SR.featureWarningWhenInliningMethodImplNoInlineMarkedFunction () /// Get a version string associated with the given feature. static member GetFeatureVersionString feature = diff --git a/src/Compiler/Facilities/LanguageFeatures.fsi b/src/Compiler/Facilities/LanguageFeatures.fsi index f471f371b95..9a3e66824a9 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fsi +++ b/src/Compiler/Facilities/LanguageFeatures.fsi @@ -47,6 +47,7 @@ type LanguageFeature = | MatchNotAllowedForUnionCaseWithNoData | CSharpExtensionAttributeNotRequired | ErrorForNonVirtualMembersOverrides + | WarningWhenInliningMethodImplNoInlineMarkedFunction /// LanguageVersion management type LanguageVersion = diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index 80a628d7595..a112e20c827 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -327,6 +327,11 @@ reprezentace struktury aktivních vzorů + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop zástupný znak ve smyčce for diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 595eedd84a1..a87239416df 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -327,6 +327,11 @@ Strukturdarstellung für aktive Muster + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop Platzhalter in for-Schleife diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 3e2407c1542..08e628b8880 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -327,6 +327,11 @@ representación de struct para modelos activos + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop carácter comodín en bucle for diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 54cad306cd2..cd5d3e0d027 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -327,6 +327,11 @@ représentation de structure pour les modèles actifs + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop caractère générique dans une boucle for diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 007dc9646b8..ac7cd1dc4f2 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -327,6 +327,11 @@ rappresentazione struct per criteri attivi + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop carattere jolly nel ciclo for diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 3d5ed3c9dae..bab5017a23f 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -327,6 +327,11 @@ アクティブなパターンの構造体表現 + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop for ループのワイルド カード diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 40bbf8e988a..800b0fc3d01 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -327,6 +327,11 @@ 활성 패턴에 대한 구조체 표현 + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop for 루프의 와일드카드 diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 136d0b7f299..11b9d7a4096 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -327,6 +327,11 @@ reprezentacja struktury aktywnych wzorców + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop symbol wieloznaczny w pętli for diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 7bd9a3a8003..369f61f734d 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -327,6 +327,11 @@ representação estrutural para padrões ativos + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop curinga para loop diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 9fd17e474e3..c871e169025 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -327,6 +327,11 @@ представление структуры для активных шаблонов + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop подстановочный знак в цикле for diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 467e88ffe74..eae15c234e6 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -327,6 +327,11 @@ etkin desenler için yapı gösterimi + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop for döngüsünde joker karakter diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index de4213c22d5..384cffbb418 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -327,6 +327,11 @@ 活动模式的结构表示形式 + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop for 循环中的通配符 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index d104380d615..987ffaa9f5c 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -327,6 +327,11 @@ 現用模式的結構表示法 + + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined. + + wild card in for loop for 迴圈中的萬用字元 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining_InlineKeyword.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining_InlineKeyword.fs new file mode 100644 index 00000000000..b40e3a3f8e0 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.NoInlining_InlineKeyword.fs @@ -0,0 +1,3 @@ +module M +[] +let inline getUnit (f : unit -> unit) = f() \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs index 51f758b7f47..183be7e87b9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/MethodImplAttribute/MethodImplAttribute.fs @@ -33,6 +33,20 @@ module MethodImplAttribute = let ``NoInlining_fs`` compilation = compilation |> verifyCompilation + + [] + let ``NoInlining_fs with inline keyword => should warn in preview version`` compilation = + compilation + |> withLangVersionPreview + |> typecheck + |> withSingleDiagnostic (Warning 3151, Line 2, Col 1, Line 3, Col 38, "This member, function or value declaration may not be declared 'inline'") + + [] + let ``NoInlining_fs with inline keyword => should not warn in F# 7 or older`` compilation = + compilation + |> withLangVersion70 + |> typecheck + |> withDiagnostics [] // SOURCE=MethodImplAttribute.AggressiveInlining.fs SCFLAGS="-a -g --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd MethodImplAttribute.AggressiveInlining.dll" # MethodImplAttribute.AggressiveInlining.fs [] diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 97808b58591..e0b2acfd2d3 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -391,6 +391,9 @@ module rec Compiler = let withLangVersion70 (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ "--langversion:7.0" ] "withLangVersion70 is only supported on F#" cUnit + let withLangVersion80 (cUnit: CompilationUnit) : CompilationUnit = + withOptionsHelper [ "--langversion:8.0" ] "withLangVersion80 is only supported on F#" cUnit + let withLangVersionPreview (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ "--langversion:preview" ] "withLangVersionPreview is only supported on F#" cUnit