Uh oh!
There was an error while loading. Please reload this page.
AddExplicitReturnType refactoring - #16077
Conversation
SebastianAtWork
commented
Oct 4, 2023
@dotnet-policy-service agree |
psfinaki
commented
Oct 5, 2023
@SebastianAtWork that's a great start! Here are a few quick tips for you:
And special thanks for testing efforts! |
9983cbc to
95ef481CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
407572f to
92ee24eCompareSebastianAtWork
commented
Oct 30, 2023
@psfinaki Im currently getting a build error after updating my branch : E:\Repos\fsharp\src\Compiler\Utilities\Cancellable.fs(12,5): error FS0902: For F#7 and lower, static value definitions |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
psfinaki
commented
Oct 30, 2023
@SebastianAtWork hmm I will check out your branch tomorrow and see if I am getting the same error, stay tuned. |
psfinaki
commented
Oct 31, 2023
@SebastianAtWork so I managed to reproduce the error in the |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
1065f22 to
d45ca33CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
6118cd5 to
69f3e11CompareSebastianAtWork
commented
Nov 13, 2023
@psfinaki Sorry for the delay. I fixed your remarks and some refactorings. Should I add another Test case for when there are multiple documents in a project and one document infers a type from a previous document? Any other test cases I should add? |
psfinaki
left a comment
There was a problem hiding this comment.
Good stuff. Left a few notes, definitely ready to review.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
psfinaki
commented
Nov 13, 2023
That would be helpful. At least to see how complicated is to have such a test. |
38a479a to
6e83b22CompareUh oh!
There was an error while loading. Please reload this page.
1814cc6 to
aa88e55CompareUh oh!
There was an error while loading. Please reload this page.
psfinaki
commented
Dec 7, 2023
@SebastianAtWork awesome, so just then please add them, take your time and no rush! |
…peTests.fs - In AddExplicitReturnType.fs: - Replaced the codeActionFunc with a cancellableTask to handle cancellation tokens. - Updated the codeActionFunc to use the new cancellableTask and getChangedText functions. - In AddExplicitReturnTypeTests.fs: - Added tests for binding another function and binding linq function without crashing. - Updated the expectedCode for these tests to include explicit return types.
SebastianAtWork
commented
Dec 13, 2023
@psfinaki I added the 2 tests that pass and produce a compilable return type. I this correct or should it produce Unit->System.DateTime? |
psfinaki
commented
Dec 13, 2023
@SebastianAtWork this is correct. We need return types, not the full signatures. Good job :) |
psfinaki
commented
Dec 13, 2023
Will take a look at this tomorrow, but seems very promising - thanks for the updates! |
psfinaki
left a comment
There was a problem hiding this comment.
Niiice! No major concerns anymore :)
I would just like to add a few more tests and remove the word explicit. Otherwise good to go IMO.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The code changes simplify the logic in the AddExplicitReturnType module. The changes remove unnecessary conditions and improve readability.
- Added a test case to ensure that the refactor correctly infers the return type of the `sum` function when it is defined on the next line. - Removed an unused import in the `RefactorTestFramework.fs` file. refactor: Add explicit return type to sum function
SebastianAtWork
commented
Dec 15, 2023
Just to understand, Why remove the explicit? Its also called AddExplicitTypeToParameter |
psfinaki
commented
Dec 15, 2023
Yeah the refactoring is called like that - but the string is "Add type annotation" (as opposed to "add explicit type annotation") - so just to align with that one :) |
The commit updates the return type annotation in multiple localization files.
- Renamed the file `AddExplicitReturnType.fs` to `AddReturnType.fs`. - Updated references to the renamed file in other files. - Updated test file names and references accordingly.
SebastianAtWork
commented
Dec 16, 2023
@psfinaki Like this ? :) Done |
psfinaki
commented
Dec 18, 2023
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
psfinaki
commented
Dec 18, 2023
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
psfinaki
commented
Dec 18, 2023
@dotnet/fsharp-team-msft please review, this is all green and resolved. |
psfinaki
commented
Dec 20, 2023
Thanks for your contribution @SebastianAtWork. I am thinking now that once this gets to the VS preview, I might write a blog post about refactorings in VS where I could also mention this one and the new testing framework :) |
SebastianAtWork
commented
Dec 21, 2023
Thanks for helping :) Good Idea yes. On which blog? |
psfinaki
commented
Dec 21, 2023
On Visual Studio .NET blog, here :) |
…and resource file entry
See Issue #15562 for Discussion
@psfinaki