-
Notifications
You must be signed in to change notification settings - Fork 825
[RFC FS-1003] Nameof operator redux #6809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Conflicts: src/fsharp/FSComp.txt src/fsharp/FSharp.Core.Unittests/SurfaceArea.Silverlight.2.0.fs src/fsharp/FSharp.Core.Unittests/SurfaceArea.net20.fs src/fsharp/PostInferenceChecks.fs src/fsharp/TastOps.fs src/fsharp/TcGlobals.fs
This reverts commit 529cc6f.
This reverts commit 223d313. Conflicts: tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs
it raises a proper error if applicated to non (Long)Ident arg
remove `typenameof and its tests
This reverts commit a732de0.
…der to not loose its FSharpSymbolUse
3130685
to
a3287ce
Compare
@cartermp on it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After chatting with @TIHan we should remove all baseline-style tests and move these to FSharp.Compiler.UnitTests. We can handle this on our end.
@KevinRansom What's the status of getting this updated with the language version flag checks please? I thought I saw you doing some work on this but I can't find it anywhere. If you are doing something, please make it a PR to the |
I am happy to merge this and then add the languageversion into release/fsharp47. That would be a better way of dealing with these language features. |
Almost squashed it .... merging :-) |
Sorry if this is the wrong place to ask, but is it intended to be possible (like in C#) to get the name of an instance member without an instance, e.g. |
It's also worth noting that what is allowable in C# for |
@@ -4142,6 +4142,9 @@ namespace Microsoft.FSharp.Core | |||
[<CompiledName("TypeOf")>] | |||
let inline typeof<'T> = BasicInlinedOperations.typeof<'T> | |||
|
|||
[<CompiledName("NameOf")>] | |||
let inline nameof (_: 'T) : string = raise (Exception "may not call directly, should always be optimized away") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we could make this have NoDynamicInvocation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not needed because the compiler knows of the special rules for this library identifier
|
||
[<Test>] | ||
member this.``lookup name of |> operator`` () = | ||
let a = nameof(|>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want to allow nameof
to get the actual names of the operators?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I'm fine with this
Continuation of #6325
Brings #2290 up-to-date with master
Implementation of RFC FS-1003
Testing verified:
Feature limitation: