Skip to content

Commit 8baa0ef

Browse files
committed
Creating local after UnifyTypes
1 parent d0ab0a4 commit 8baa0ef

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/fsharp/TypeChecker.fs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6932,6 +6932,16 @@ and TcRecdExpr cenv overallTy env tpenv (inherits, optOrigExpr, flds, mWholeExpr
69326932
let requiresCtor = (GetCtorShapeCounter env = 1) // Get special expression forms for constructors
69336933
let haveCtor = Option.isSome inherits
69346934

6935+
let optOrigExpr, tpenv =
6936+
match optOrigExpr with
6937+
| None -> None, tpenv
6938+
| Some (origExpr, _) ->
6939+
match inherits with
6940+
| Some (_, _, mInherits, _, _) -> error(Error(FSComp.SR.tcInvalidRecordConstruction(), mInherits))
6941+
| None ->
6942+
let olde, tpenv = TcExpr cenv overallTy env tpenv origExpr
6943+
Some (olde), tpenv
6944+
69356945
let hasOrigExpr = optOrigExpr.IsSome
69366946

69376947
let fldsList =
@@ -6959,16 +6969,12 @@ and TcRecdExpr cenv overallTy env tpenv (inherits, optOrigExpr, flds, mWholeExpr
69596969
| Some v -> yield n, v
69606970
| None -> () ]
69616971

6962-
let optOrigExprInfo, tpenv =
6963-
match optOrigExpr with
6964-
| None -> None, tpenv
6965-
| Some (origExpr, _) ->
6966-
match inherits with
6967-
| Some (_, _, mInherits, _, _) -> error(Error(FSComp.SR.tcInvalidRecordConstruction(), mInherits))
6968-
| None ->
6969-
let olde, tpenv = TcExpr cenv overallTy env tpenv origExpr
6970-
let oldvaddr, oldvaddre = mkCompGenLocal mWholeExpr "inputRecord" (if isStructTy cenv.g overallTy then mkByrefTy cenv.g overallTy else overallTy)
6971-
Some (olde, oldvaddr, oldvaddre), tpenv
6972+
let optOrigExprInfo =
6973+
match optOrigExpr with
6974+
| None -> None
6975+
| Some(olde) ->
6976+
let oldvaddr, oldvaddre = mkCompGenLocal mWholeExpr "inputRecord" (if isStructTy cenv.g overallTy then mkByrefTy cenv.g overallTy else overallTy)
6977+
Some(olde, oldvaddr, oldvaddre)
69726978

69736979
if hasOrigExpr && not (isRecdTy cenv.g overallTy) then
69746980
errorR(Error(FSComp.SR.tcExpressionFormRequiresRecordTypes(), mWholeExpr))

0 commit comments

Comments
 (0)