@@ -2884,6 +2884,11 @@ let isSizeOfValRef g vref =
28842884// There is an internal version of typeof defined in prim-types.fs that needs to be detected
28852885|| ( g.compilingFslib&& vref.LogicalName= " sizeof" )
28862886
2887+ let isNameOfValRef g vref =
2888+ valRefEq g vref g.nameof_ vref
2889+ // There is an internal version of typeof defined in prim-types.fs that needs to be detected
2890+ || ( g.compilingFslib&& vref.LogicalName= " nameof" )
2891+
28872892let isTypeDefOfValRef g vref =
28882893 valRefEq g vref g.typedefof_ vref
28892894// There is an internal version of typedefof defined in prim-types.fs that needs to be detected
@@ -2909,6 +2914,11 @@ let (|TypeDefOfExpr|_|) g expr =
29092914| Expr.App( Expr.Val( vref,_,_),_,[ ty],[],_) when isTypeDefOfValRef g vref-> Some ty
29102915| _ -> None
29112916
2917+ let (| NameOfExpr | _ |) g expr =
2918+ match exprwith
2919+ | Expr.App( Expr.Val( vref,_,_),_,[ ty],[],_) when isNameOfValRef g vref-> Some ty
2920+ | _ -> None
2921+
29122922let (| SeqExpr | _ |) g expr =
29132923match exprwith
29142924| Expr.App( Expr.Val( vref,_,_),_,_,_,_) when valRefEq g vref g.seq_ vref-> Some()
@@ -7743,7 +7753,8 @@ let IsSimpleSyntacticConstantExpr g inputExpr =
77437753| Expr.Op( TOp.UnionCase_,_,[],_) // Nullary union cases
77447754| UncheckedDefaultOfExpr g_
77457755| SizeOfExpr g_
7746- | TypeOfExpr g_ -> true
7756+ | TypeOfExpr g_
7757+ | NameOfExpr g_ -> true
77477758// All others are not simple constant expressions
77487759| _ -> false
77497760