Skip to content

Commit 9caf38c

Browse files
committed
Fix for unit-in-try bug.
1 parent 9270506 commit 9caf38c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/ProvidedTypes.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16046,9 +16046,12 @@ namespace ProviderImplementation.ProvidedTypes
1604616046

1604716047
let methLocals = Dictionary<Var, ILLocalBuilder>()
1604816048

16049-
let expectedState = if (transType minfo.ReturnType = ILType.Void) then ExpectedStackState.Empty else ExpectedStackState.Value
16049+
let retType = transType minfo.ReturnType
16050+
let retUnit = retType = ILType.Void || retType.QualifiedName = (transType (convTypeToTgt typeof<unit>)).QualifiedName
16051+
let expectedState = if retUnit then ExpectedStackState.Empty else ExpectedStackState.Value
1605016052
let codeGen = CodeGenerator(assemblyMainModule, genUniqueTypeName, implicitCtorArgsAsFields, convTypeToTgt, transType, transFieldSpec, transMeth, transMethRef, transCtorSpec, ilg, methLocals, parameterVars)
1605116053
codeGen.EmitExpr (expectedState, expr)
16054+
if retUnit then ilg.Emit(I_ldnull)
1605216055
ilg.Emit I_ret
1605316056
| _ -> ()
1605416057

0 commit comments

Comments
 (0)