Skip to content

Add AddMissingEqualsToTypeDefinition code fixer#10470

Merged
cartermp merged 5 commits intodotnet:mainfrom
cartermp:add-missing-equals-type-defn
Nov 18, 2020
Merged

Add AddMissingEqualsToTypeDefinition code fixer#10470
cartermp merged 5 commits intodotnet:mainfrom
cartermp:add-missing-equals-type-defn

Conversation

@cartermp
Copy link
Copy Markdown
Contributor

@cartermp cartermp commented Nov 16, 2020

Another common error that gets people: #1121

image

Also works for DU and type abbreviation declarations.

image

meow

@cartermp
Copy link
Copy Markdown
Contributor Author

This is ready for review

Copy link
Copy Markdown
Contributor

@KevinRansom KevinRansom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking for '=' in the error text seems a bit too hit or miss.

@cartermp
Copy link
Copy Markdown
Contributor Author

Okay, this one is fine as-is but a better approach is to make the error code unique rather than filter based on a heuristic

@cartermp cartermp added this to the 16.9 milestone Nov 17, 2020
@cartermp
Copy link
Copy Markdown
Contributor Author

Okay @KevinRansom I changed this to only trigger on the specific parse error that we raise for type declarations.

I'll likely look into a separate error message for class declarations in a different PR, and then add that to this fixer only when that specific error message is available.

This will avoid the heuristic of checking the contents of the message and avoid the case that @baronfel found.

@cartermp cartermp requested a review from KevinRansom November 18, 2020 01:25
@cartermp cartermp merged commit 107d4cf into dotnet:main Nov 18, 2020
@smoothdeveloper
Copy link
Copy Markdown
Contributor

@cartermp should those code fixes also come with few tests to at least highlight the happy case?

This will avoid regressions of the happy case, and if later on we find false positive or bugs, having tests for positive case provides aproximate exemple on how to write such test.

I feel this would apply to all the code fixes PR that came recently.

nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
* Add AddMissingEqualsToTypeDefinition code fixer

* Restrict to FS3360
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Jan 26, 2022
* Add AddMissingEqualsToTypeDefinition code fixer

* Restrict to FS3360
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Jan 26, 2022
* Add AddMissingEqualsToTypeDefinition code fixer

* Restrict to FS3360
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants