Skip to content

Commit 0ddbed6

Browse files
committed
Fix a broken debug assertion that kicked in whenever building Fsharp.Core in Debug
1 parent 1d31535 commit 0ddbed6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Compiler/Checking/CheckExpressions.fs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,7 +2204,7 @@ module GeneralizationHelpers =
22042204
// ComputeInlineFlag
22052205
//-------------------------------------------------------------------------
22062206

2207-
let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable hasNoCompilerInliningAttribute m =
2207+
let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable enforceNoInlining m =
22082208
let inlineFlag =
22092209
let isCtorOrAbstractSlot =
22102210
match memFlagsOption with
@@ -2215,7 +2215,7 @@ let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable
22152215
// Constructors may never be inlined
22162216
// Calls to virtual/abstract slots may never be inlined
22172217
// Values marked with NoCompilerInliningAttribute may never be inlined
2218-
if isMutable || isCtorOrAbstractSlot || hasNoCompilerInliningAttribute then
2218+
if isMutable || isCtorOrAbstractSlot || enforceNoInlining then
22192219
ValInline.Never
22202220
elif isInline then
22212221
ValInline.Always
@@ -12042,6 +12042,12 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind
1204212042
let attrs = TcAttributes cenv env attrTgt synAttrs
1204312043
let newOk = if canInferTypars then NewTyparsOK else NoNewTypars
1204412044
let hasNoCompilerInliningAttribute = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute attrs
12045+
let hasMethodImplNoInlining =
12046+
match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with
12047+
// NO_INLINING = 8
12048+
| Some (Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> (flags &&& 0x8) <> 0x0
12049+
| _ -> false
12050+
let forceDoNotInline = hasNoCompilerInliningAttribute || hasMethodImplNoInlining
1204512051

1204612052
let valinfos, tpenv = TcValSpec cenv env declKind newOk containerInfo memFlagsOpt None tpenv synValSig attrs
1204712053
let denv = env.DisplayEnv
@@ -12050,7 +12056,7 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind
1205012056

1205112057
let (ValSpecResult (altActualParent, memberInfoOpt, id, enclosingDeclaredTypars, declaredTypars, ty, prelimValReprInfo, declKind)) = valSpecResult
1205212058

12053-
let inlineFlag = ComputeInlineFlag (memberInfoOpt |> Option.map (fun (PrelimMemberInfo(memberInfo, _, _)) -> memberInfo.MemberFlags)) isInline mutableFlag hasNoCompilerInliningAttribute m
12059+
let inlineFlag = ComputeInlineFlag (memberInfoOpt |> Option.map (fun (PrelimMemberInfo(memberInfo, _, _)) -> memberInfo.MemberFlags)) isInline mutableFlag forceDoNotInline m
1205412060

1205512061
let freeInType = freeInTypeLeftToRight g false ty
1205612062

0 commit comments

Comments
 (0)