-
Notifications
You must be signed in to change notification settings - Fork 786
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
Allow _.Property / _.MethodCall() / _.IndexerAccess[idx] shorthand for accessor functions #13907
Conversation
I've renamed it and added link to the suggestion, hope you don't mind @tboby |
0f99e4d
to
0deb688
Compare
bc43986
to
ad0743b
Compare
I think this is now a working proof of concept that implements the minimum features described in the suggestions issue. Things I'm pretty sure need improving:
|
@tboby please also make sure that the feature is under a language feature flag. |
I guess it is very questionable whether these really had their own right to exist. From a syntax point of view, they can be captured in their non-bang counterpart. At the same time, the updated index syntax (
I very much would like to see that on record in the RFC. Because this will pop up eventually as a bug report on Fantomas' side. Should an application with a |
I have added:
I am open to suggestions on how to:
|
The opening suggestion would be to analyze the inner synExpr (of the DotLambda node) in CheckExpressions and look for NonAtomic App . If one is found , report it. Something like: |
I think the technical differentiation will be in not allowing NonAtomic App nodes (unless someone/something proves me wrong in that, it is just my initial guess). The error message for end users must of course use a different vocabulary, I am open for suggestions here. |
Yeah, we should (for now) disallow spaces and add note it in pr. Support for spaces and partial application (for untupled method) might be an additional feature. |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
tests/FSharp.Compiler.ComponentTests/Language/DotLambdaTests.fs
Outdated
Show resolved
Hide resolved
The diagnostics for incorrect usages updated and reflected in tests:
|
_.foo.bar- > fun x - > x.foo.bar
link to suggestion - fsharp/fslang-suggestions#506
RFC PR : fsharp/fslang-design#710
Allowed constructs
Treating _.expression as fun x -> x.expression
Now with correct coloring and autocomplete:
And with right-hand-side derivation of the input type:
(not saying I would recommend such style of coding)