-
Notifications
You must be signed in to change notification settings - Fork 833
[FS-1056] Allow overloads of custom keywords in computation expressions #9400
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
[FS-1056] Allow overloads of custom keywords in computation expressions #9400
Conversation
54537e3 to
95fcd9c
Compare
95fcd9c to
3ee5a49
Compare
|
Thanks for picking this up @panesofglass! In terms of tests, the best place to put them for now would be in the FSharpSuite here: https://github.com/dotnet/fsharp/tree/master/tests/fsharp/Compiler/Conformance |
|
Thanks for the tip, @cartermp. I was planning to take a gander at that tonight. |
c7357ac to
a5bc4ad
Compare
a5bc4ad to
c6f4e47
Compare
|
Looks like the |
|
@isaacabraham this would really help with the things we discussed re: https://github.com/CompositionalIT/farmer |
|
Mmmm. It feels like overloads in CEs is kind of a hidden feature at the moment that doesn't quite work. Supporting overloads would definitely be useful. |
|
@dsyme what do you think of some of these test failures? There's some oddities in this space in general, but I'm not sure if these would be expected or if they're indicative of a different issue with overload resolution. |
|
Beyond the ParamArray issue I found overloads with different arities aren't picked up when using @panesofglass workaround. Though maybe this will * just work * once all methods can be attributed? Worth a test, anyway. |
|
When I tried to remove the artificial limitations in the past, the |
|
@Nhowka are my tests incorrect? Is there a better way to go about this? |
|
I think it's probably just missing an |
tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs
Show resolved
Hide resolved
While I understand the reason, I'm not sure if I agree. This is an unbreaking change, in the sense that code that used to fail to compile when using a computation expression that had that kind of overload will now just work. Note that the computation expression builder itself used to compile with no problem, the error to compile were just when using the custom keywords. In the RFC I added an example of that happening, the library was compiled with no warnings and then when the client tried to use it, the error happened. I think that making the code that failed to compile suddenly working wouldn't be that bad, but I don't know if there an existing policy to treat these cases... |
|
Note that the langversion switch isn't about breaking changes or not. It's a means of separating preview features from non-preview features. Any new feature that is merged is preview, and we deliberately "promote" them to a language version when it makes sense. My mistake for approving right away, this needs a new case here: https://github.com/dotnet/fsharp/blob/master/src/fsharp/LanguageFeatures.fs#L36 and the associated check in both places in the typechecker. Testing appears to use the preview flag already outside of the fsharpQA cases - @KevinRansom how should the fsharpqa cases be handled? |
|
I understand it better now, makes sense! |
|
For the feature string would it just need a new line on |
src/fsharp/FSComp.txt
Outdated
| 3380,parsEofInInterpolatedVerbatimString,"Incomplete interpolated verbatim string begun at or before here" | ||
| 3381,parsEofInInterpolatedTripleQuoteString,"Incomplete interpolated triple-quote string begun at or before here" | ||
| 3382,lexRBraceInInterpolatedString,"A '}}' character must be escaped (by doubling) in an interpolated string." | ||
| featureOverloadsForCustomOperations,"overloads for custom operations" |
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 believe line around 1514 would be better to group the features together
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 moved it further up next to the line that says overloads are not allowed.
|
@cartermp or @KevinRansom how do I set up the tests to pass now? |
|
@panesofglass For the desktop_Release failure, you have baseline differences in There's a way to update the baselines on your local machine automatically (I need to look it up), or you can manually run and adjust and throw it back at CI. Here are three command lines yo ucan use to recreate the error files and replace the baseline files: You also have three failures in "fsharpqa" 2020-08-08T01:59:58.0125197Z Conformance\Expressions\DataExpressions\QueryExpressions (E_WhitespaceErrors01.fs) -- failed Unfortunately they aren't showing here so you'll have to manually try to work out what the relevant command line is from |
|
Sorry for all the hassle, especially the fsharpqa tests. They're really quite awful to adjust, but we're planning on moving them to be normal tests that are easy to run and diagnose |
This reverts commit 3ee5a49.
|
@cartermp do you need me to rebase and/or merge commits to clean up the commit history? |
|
@panesofglass we tend to use squash commits here, so it should be good to go. @KevinRansom - want to re-review? |
|
@KevinRansom this now correctly guards against the flag and all tests are updated. Looking good? I'd like to get this one in soon. |
|
Thanks @panesofglass and @Nhowka! |
|
This is absolutely great! Thank you all! |
|
Awesome stuff. If this was in the box a month ago the pulumiprovider that I helped out on would be in a much better shape: https://github.com/UnoSD/Pulumi.FSharp.Extensions. Great to see this happen! |
…ns (dotnet#9400) * Remove limitations on custom operation overloads - Check 1:1 by operation/method names instead of count - Remove arg count check (cherry picked from commit 854f080) * Updated baselines (cherry picked from commit 527eb54) * New error messages (cherry picked from commit cdc765d) * Add failing tests based on RFC * Expand test cases for overloaded CE members * open Extensions to fix tests * Fix error with opening missing Extensions module * Fix unit tests * Give unique values for each check in CE overload tests * Add regression scenarios to ensure current functionality does not break for computation expression overloads [FS-1056] * Rename g to group per code review [FS-1056] * Hide overloads for custom operations behind feature flag [FS-1056] * Add feature flag to GetFeatureString * Add featureOverloadsForCustomOperations to FSComps * Update FSComp.txt [FS-1056] * Update baselines [FS-1056] * Revert "New error messages" This reverts commit 3ee5a49. Co-authored-by: Diego Esmerio <[email protected]> Co-authored-by: Diego Esmerio <[email protected]>
This is an update to #4949
Implementation for fsharp/fslang-suggestions#69.
RFC here
tests in progress.
cc @KevinRansom and @Nhowka