Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit77c8f77

Browse files
revert nameof and typenameof functions to FSharp.Core
1 parent8fd0392 commit77c8f77

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

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

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

4751+
[<CompiledName("TypeNameOf")>]
4752+
let inlinetypenameof<'T>:string= raise(Exception"may not call directly, should always be optimized away")
4753+
4754+
[<CompiledName("NameOf")>]
4755+
let inlinenameof(_:'T):string= raise(Exception"may not call directly, should always be optimized away")
4756+
47514757
[<CompiledName("MethodHandleOf")>]
47524758
letmethodhandleof(_call:('T-> 'TResult)):System.RuntimeMethodHandle= raise(Exception"may not call directly, should always be optimized away")
47534759

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

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

2323+
///<summary>Returns the name of the given static type.</summary>
2324+
[<RequiresExplicitTypeArguments>]
2325+
[<CompiledName("TypeNameOf")>]
2326+
val inline typenameof<'T>:string
2327+
2328+
///<summary>Returns the name of the given symbol.</summary>
2329+
[<CompiledName("NameOf")>]
2330+
val inline nameof: 'T->string
2331+
23232332
///<summary>An internal,library-only compiler intrinsic for compile-time
23242333
///generation of a RuntimeMethodHandle.</summary>
23252334
[<CompiledName("MethodHandleOf")>]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp