Skip to content

Commit a732de0

Browse files
remove nameof function form FSharp.Core
1 parent b26994c commit a732de0

File tree

12 files changed

+30
-58
lines changed

12 files changed

+30
-58
lines changed

src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,10 +2632,8 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" +
26322632
Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" +
26332633
#endif
26342634
@"
2635-
Microsoft.FSharp.Core.Operators: System.String NameOf[T](T)
26362635
Microsoft.FSharp.Core.Operators: System.String ToString()
26372636
Microsoft.FSharp.Core.Operators: System.String ToString[T](T)
2638-
Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]()
26392637
Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String)
26402638
Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue])
26412639
Microsoft.FSharp.Core.Operators: System.Type GetType()

src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2604,10 +2604,8 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" +
26042604
Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" +
26052605
#endif
26062606
@"
2607-
Microsoft.FSharp.Core.Operators: System.String NameOf[T](T)
26082607
Microsoft.FSharp.Core.Operators: System.String ToString()
26092608
Microsoft.FSharp.Core.Operators: System.String ToString[T](T)
2610-
Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]()
26112609
Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String)
26122610
Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue])
26132611
Microsoft.FSharp.Core.Operators: System.Type GetType()

src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,10 +2606,8 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" +
26062606
Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" +
26072607
#endif
26082608
@"
2609-
Microsoft.FSharp.Core.Operators: System.String NameOf[T](T)
26102609
Microsoft.FSharp.Core.Operators: System.String ToString()
26112610
Microsoft.FSharp.Core.Operators: System.String ToString[T](T)
2612-
Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]()
26132611
Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String)
26142612
Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue])
26152613
Microsoft.FSharp.Core.Operators: System.Type GetType()

src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,10 +2617,8 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" +
26172617
Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" +
26182618
#endif
26192619
@"
2620-
Microsoft.FSharp.Core.Operators: System.String NameOf[T](T)
26212620
Microsoft.FSharp.Core.Operators: System.String ToString()
26222621
Microsoft.FSharp.Core.Operators: System.String ToString[T](T)
2623-
Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]()
26242622
Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String)
26252623
Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue])
26262624
Microsoft.FSharp.Core.Operators: System.Type GetType()

src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2604,10 +2604,8 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" +
26042604
Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" +
26052605
#endif
26062606
@"
2607-
Microsoft.FSharp.Core.Operators: System.String NameOf[T](T)
26082607
Microsoft.FSharp.Core.Operators: System.String ToString()
26092608
Microsoft.FSharp.Core.Operators: System.String ToString[T](T)
2610-
Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]()
26112609
Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String)
26122610
Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue])
26132611
Microsoft.FSharp.Core.Operators: System.Type GetType()

src/fsharp/FSharp.Core/prim-types.fs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4748,9 +4748,6 @@ namespace Microsoft.FSharp.Core
47484748
[<CompiledName("TypeOf")>]
47494749
let inline typeof<'T> = BasicInlinedOperations.typeof<'T>
47504750

4751-
[<CompiledName("NameOf")>]
4752-
let inline nameof (_: 'T) : string = raise (Exception "may not call directly, should always be optimized away")
4753-
47544751
[<CompiledName("MethodHandleOf")>]
47554752
let methodhandleof (_call: ('T -> 'TResult)) : System.RuntimeMethodHandle = raise (Exception "may not call directly, should always be optimized away")
47564753

src/fsharp/FSharp.Core/prim-types.fsi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,10 +2320,6 @@ namespace Microsoft.FSharp.Core
23202320
[<CompiledName("TypeOf")>]
23212321
val inline typeof<'T> : System.Type
23222322

2323-
/// <summary>Returns the name of the given symbol.</summary>
2324-
[<CompiledName("NameOf")>]
2325-
val inline nameof : 'T -> string
2326-
23272323
/// <summary>An internal, library-only compiler intrinsic for compile-time
23282324
/// generation of a RuntimeMethodHandle.</summary>
23292325
[<CompiledName("MethodHandleOf")>]

src/fsharp/PostInferenceChecks.fs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,6 @@ and CheckVal (cenv:cenv) (env:env) v m context =
514514
if isSpliceOperator cenv.g v then errorR(Error(FSComp.SR.chkNoFirstClassSplicing(), m))
515515
if valRefEq cenv.g v cenv.g.addrof_vref then errorR(Error(FSComp.SR.chkNoFirstClassAddressOf(), m))
516516
if valRefEq cenv.g v cenv.g.reraise_vref then errorR(Error(FSComp.SR.chkNoFirstClassRethrow(), m))
517-
if valRefEq cenv.g v cenv.g.nameof_vref then errorR(Error(FSComp.SR.chkNoFirstClassNameOf(), m))
518517
if noByrefs context && isByrefLikeTy cenv.g v.Type then
519518
// byref typed val can only occur in permitting contexts
520519
errorR(Error(FSComp.SR.chkNoByrefAtThisPoint(v.DisplayName), m))

src/fsharp/TastOps.fs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,11 +2884,6 @@ 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-
28922887
let isTypeDefOfValRef g vref =
28932888
valRefEq g vref g.typedefof_vref
28942889
// There is an internal version of typedefof defined in prim-types.fs that needs to be detected
@@ -2914,11 +2909,6 @@ let (|TypeDefOfExpr|_|) g expr =
29142909
| Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isTypeDefOfValRef g vref -> Some ty
29152910
| _ -> None
29162911

2917-
let (|NameOfExpr|_|) g expr =
2918-
match expr with
2919-
| Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isNameOfValRef g vref -> Some ty
2920-
| _ -> None
2921-
29222912
let (|SeqExpr|_|) g expr =
29232913
match expr with
29242914
| Expr.App(Expr.Val(vref,_,_),_,_,_,_) when valRefEq g vref g.seq_vref -> Some()
@@ -7753,8 +7743,7 @@ let IsSimpleSyntacticConstantExpr g inputExpr =
77537743
| Expr.Op (TOp.UnionCase _,_,[],_) // Nullary union cases
77547744
| UncheckedDefaultOfExpr g _
77557745
| SizeOfExpr g _
7756-
| TypeOfExpr g _
7757-
| NameOfExpr g _ -> true
7746+
| TypeOfExpr g _ -> true
77587747
// All others are not simple constant expressions
77597748
| _ -> false
77607749

src/fsharp/TastOps.fsi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,6 @@ val (|AttribBitwiseOrExpr|_|) : TcGlobals -> Expr -> (Expr * Expr) option
14091409
val (|EnumExpr|_|) : TcGlobals -> Expr -> Expr option
14101410
val (|TypeOfExpr|_|) : TcGlobals -> Expr -> TType option
14111411
val (|TypeDefOfExpr|_|) : TcGlobals -> Expr -> TType option
1412-
val (|NameOfExpr|_|) : TcGlobals -> Expr -> TType option
14131412
val (|SeqExpr|_|) : TcGlobals -> Expr -> unit option
14141413

14151414
val EvalLiteralExprOrAttribArg: TcGlobals -> Expr -> Expr

0 commit comments

Comments
 (0)