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

special handling of optional fields when destructuring #715

Merged
merged 3 commits into from
Jan 26, 2023

Conversation

zth
Copy link
Collaborator

@zth zth commented Jan 25, 2023

Closes #714

cc @cknitt

@zth zth requested a review from cristianoc January 25, 2023 18:58
@@ -1047,10 +1047,10 @@ let printConstructorArgs argsLen ~asSnippet =
if List.length !args > 0 then "(" ^ (!args |> String.concat ", ") ^ ")"
else ""

type completionMode = Pattern | Expression
type completionMode = Pattern of Completable.patternMode option | Expression
Copy link
Member

Choose a reason for hiding this comment

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

I am wondering if we can get rid of the option here by having

type patternMode = Default | Destructuring

or something like that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good point.

Copy link
Collaborator

@cristianoc cristianoc left a comment

Choose a reason for hiding this comment

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

Does this affect destructuring only, or also explicit switches?

@zth
Copy link
Collaborator Author

zth commented Jan 26, 2023

Right now it's configured to only affect let destructures.

@zth zth merged commit 303ffbf into master Jan 26, 2023
@zth zth deleted the special-case-opt-fields-in-destructuring branch January 26, 2023 16:59
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.

Add ? when destructuring for optional fields
3 participants