diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 8423093037e..b08b9632f10 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -5468,12 +5468,11 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE CallExprHasTypeSink cenv.tcSink (m, env.NameEnv, overallTy.Commit, env.AccessRights) TcConstExpr cenv overallTy env m tpenv synConst | SynExpr.DotLambda (synExpr, m) -> - let unitVar = mkSynId m "unitVar" - let svar = mkSynCompGenSimplePatVar unitVar - let pushedExpr = pushUnitArg synExpr unitVar + let unaryArg = mkSynId m (cenv.synArgNameGenerator.New()) + let svar = mkSynCompGenSimplePatVar unaryArg + let pushedExpr = pushUnaryArg synExpr unaryArg let lambda = SynExpr.Lambda(false, false, SynSimplePats.SimplePats([ svar ], m), pushedExpr, None, m, SynExprLambdaTrivia.Zero) TcIteratedLambdas cenv true env overallTy Set.empty tpenv lambda - // TcIteratedLambda | SynExpr.Lambda _ -> TcIteratedLambdas cenv true env overallTy Set.empty tpenv synExpr diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs index 2c7839167ac..34bea67cda7 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs @@ -63,7 +63,7 @@ let mkSynSimplePatVar isOpt id = let mkSynCompGenSimplePatVar id = SynSimplePat.Id(id, None, true, false, false, id.idRange) -let rec pushUnitArg expr arg = +let rec pushUnaryArg expr arg = match expr with | SynExpr.App (ExprAtomicFlag.Atomic, infix, SynExpr.Ident ident, x1, m1) -> SynExpr.App( @@ -86,17 +86,17 @@ let rec pushUnitArg expr arg = m1 ) | SynExpr.App (ExprAtomicFlag.Atomic, infix, (SynExpr.App (_) as innerApp), x1, m1) -> - SynExpr.App(ExprAtomicFlag.Atomic, infix, (pushUnitArg innerApp arg), x1, m1) + SynExpr.App(ExprAtomicFlag.Atomic, infix, (pushUnaryArg innerApp arg), x1, m1) | SynExpr.App (ExprAtomicFlag.Atomic, infix, SynExpr.DotGet (synExpr, rangeOfDot, synLongIdent, range), x1, m1) -> - SynExpr.App(ExprAtomicFlag.Atomic, infix, SynExpr.DotGet((pushUnitArg synExpr arg), rangeOfDot, synLongIdent, range), x1, m1) + SynExpr.App(ExprAtomicFlag.Atomic, infix, SynExpr.DotGet((pushUnaryArg synExpr arg), rangeOfDot, synLongIdent, range), x1, m1) | SynExpr.App (ExprAtomicFlag.Atomic, infix, innerExpr, x1, m1) -> - SynExpr.App(ExprAtomicFlag.Atomic, infix, pushUnitArg innerExpr arg, x1, m1) + SynExpr.App(ExprAtomicFlag.Atomic, infix, pushUnaryArg innerExpr arg, x1, m1) | SynExpr.Ident ident -> SynExpr.LongIdent(false, SynLongIdent(arg :: ident :: [], [ ident.idRange ], [ None ]), None, ident.idRange) | SynExpr.LongIdent (isOptional, SynLongIdent (id, dotRanges, trivia), altNameRefCell, range) -> SynExpr.LongIdent(isOptional, SynLongIdent(arg :: id, dotRanges, trivia), altNameRefCell, range) - | SynExpr.DotGet (synExpr, rangeOfDot, synLongIdent, range) -> SynExpr.DotGet(pushUnitArg synExpr arg, rangeOfDot, synLongIdent, range) + | SynExpr.DotGet (synExpr, rangeOfDot, synLongIdent, range) -> SynExpr.DotGet(pushUnaryArg synExpr arg, rangeOfDot, synLongIdent, range) | SynExpr.DotIndexedGet (objectExpr, indexArgs, dotRange, range) -> - SynExpr.DotIndexedGet(pushUnitArg objectExpr arg, indexArgs, dotRange, range) + SynExpr.DotIndexedGet(pushUnaryArg objectExpr arg, indexArgs, dotRange, range) | _ -> expr // | SynExpr.App(ExprAtomicFlag.Atomic, infix, innerExpr, x1, m1) let (|SynSingleIdent|_|) x = diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi index d5ab4b6b6fc..755a03bf082 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fsi @@ -41,7 +41,7 @@ val mkSynSimplePatVar: isOpt: bool -> id: Ident -> SynSimplePat val mkSynCompGenSimplePatVar: id: Ident -> SynSimplePat -val pushUnitArg: expr: SynExpr -> arg: Ident -> SynExpr +val pushUnaryArg: expr: SynExpr -> arg: Ident -> SynExpr /// Match a long identifier, including the case for single identifiers which gets a more optimized node in the syntax tree. val (|LongOrSingleIdent|_|):