@@ -8249,22 +8249,32 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty (
82498249 // it is an error or a computation expression
82508250 match UnifyFunctionTypeUndoIfFailed cenv denv mFunExpr exprty with
82518251 | Some (domainTy,resultTy) ->
8252-
8253- // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library.
8254- // Set a flag in the syntax tree to say we noticed a leading 'seq'
8255- match synArg with
8256- | SynExpr.CompExpr (false,isNotNakedRefCell,_comp,_m) ->
8257- isNotNakedRefCell :=
8258- !isNotNakedRefCell
8259- ||
8260- (match expr with
8261- | ApplicableExpr(_,Expr.Op(TOp.Coerce,_,[Expr.App(Expr.Val(vf,_,_),_,_,_,_)],_),_) when valRefEq cenv.g vf cenv.g.seq_vref -> true
8262- | _ -> false)
8263- | _ -> ()
8264-
8265- let arg,tpenv = TcExpr cenv domainTy env tpenv synArg
8266- let exprAndArg = buildApp cenv expr exprty arg mExprAndArg
8267- TcDelayed cenv overallTy env tpenv mExprAndArg exprAndArg resultTy atomicFlag delayed
8252+ match expr, synArg with
8253+ | (ApplicableExpr(_, Expr.Val(vref,_,_), _), SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _))
8254+ when valRefEq cenv.g vref cenv.g.nameof_vref && not (isNil idents) ->
8255+
8256+ let argIdent = List.last idents
8257+ let r = expr.Range
8258+ // generate fake `range` for the constant the `nameof(..)` we are substituting
8259+ let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes
8260+ TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed
8261+ | _ ->
8262+ // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library.
8263+ // Set a flag in the syntax tree to say we noticed a leading 'seq'
8264+ match synArg with
8265+ | SynExpr.CompExpr (false,isNotNakedRefCell,_comp,_m) ->
8266+ isNotNakedRefCell :=
8267+ !isNotNakedRefCell
8268+ ||
8269+ (match expr with
8270+ | ApplicableExpr(_,Expr.Op(TOp.Coerce,_,[Expr.App(Expr.Val(vf,_,_),_,_,_,_)],_),_) when valRefEq cenv.g vf cenv.g.seq_vref -> true
8271+ | _ -> false)
8272+ | _ -> ()
8273+
8274+ let arg,tpenv = TcExpr cenv domainTy env tpenv synArg
8275+ let exprAndArg = buildApp cenv expr exprty arg mExprAndArg
8276+ TcDelayed cenv overallTy env tpenv mExprAndArg exprAndArg resultTy atomicFlag delayed
8277+
82688278 | None ->
82698279 // OK, 'expr' doesn't have function type, but perhaps 'expr' is a computation expression builder, and 'arg' is '{ ... }'
82708280 match synArg with