Skip to content
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

Add field names to types in TypedTree #10814

Merged
merged 1 commit into from
Dec 29, 2020

Conversation

ErikSchierboom
Copy link
Contributor

As suggested in the Learn me some F# compiler video, it would be beneficial to have field names added to discriminated union fields. This PR is a first attempt at doing so.

I've tried to add names to a fairly limited number of types, as I wanted to get some feedback on the naming that I've used. I've used the following to decide upon the naming:

  • Use the names as specified in the comments. Some DU fields had comments that contained suggestions for the field names, in which case I've used those.
  • Do a Find on the type and see what the pattern matched field names are where the type is being pattern matched upon.

I've also tried to use the abbreviations specified in the Coding standards and idioms guide where possible, but I don't know exactly when to deviate from that.

Let me know if this PR is headed in the right direction, or if this needs work.

Copy link
Member

@vzarytovskii vzarytovskii left a comment

Choose a reason for hiding this comment

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

That is great. Thank you!

@ErikSchierboom
Copy link
Contributor Author

@vzarytovskii Great to hear! I'll probably do more follow-up PRs then :)

Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

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

Thanks, like the name changes.

@cartermp cartermp merged commit 2338353 into dotnet:main Dec 29, 2020
@ErikSchierboom ErikSchierboom deleted the add-du-field-names branch December 29, 2020 18:06
Copy link
Contributor

@ScottHutchinson ScottHutchinson left a comment

Choose a reason for hiding this comment

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

Thanks. Just a couple minor quibbles.

@@ -2359,18 +2363,18 @@ type TraitConstraintSln =
/// ty -- the type and its instantiation
/// vref -- the method that solves the trait constraint
/// minst -- the generic method instantiation
| FSMethSln of TType * ValRef * TypeInst
| FSMethSln of ty: TType * vref: ValRef * minsts: TypeInst
Copy link
Contributor

Choose a reason for hiding this comment

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

minst

@@ -4825,7 +4829,7 @@ type ValUseFlag =
/// a .NET 2.0 constrained call. A constrained call is only used for calls where
// the object argument is a value type or generic type, and the call is to a method
// on System.Object, System.ValueType, System.Enum or an interface methods.
| PossibleConstrainedCall of TType
| PossibleConstrainedCall of typ: TType
Copy link
Contributor

Choose a reason for hiding this comment

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

ty

@ErikSchierboom
Copy link
Contributor Author

@ScottHutchinson Shall I correct them in a follow-up PR?

@ScottHutchinson
Copy link
Contributor

I guess so, since this one has been merged. I don't know how else to do it. Sorry I didn't review this before it was merged. I have no authority here, so do as you think best.

@ErikSchierboom
Copy link
Contributor Author

Will do. I was planning to do a follow-up anyway :)

@ErikSchierboom
Copy link
Contributor Author

@ScottHutchinson I've fixed the issue you mentioned in https://github.com/dotnet/fsharp/pull/10820/files

nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
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