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

Make the partial match suggestion easier to copy-paste #6656

Merged
merged 2 commits into from
Mar 5, 2024

Conversation

cometkim
Copy link
Member

In current behavior:

let next = (state, event) => {
  // Compiler understand what type you want here, without additional annotations
  switch (state, event) {
    | (Paused(data), Start | Resume) => Running(data)
    | (Running({ count }), Increase) => Running({ count: count + 1 })
    | (Running({ count }), Decrease) => Running({ count: count - 1 })
    | (Running({ count }), Pause) => Paused({ count: count })
    | (_, Reset) => init()
  }
}
You forgot to handle a possible case here, for example: 
  (Running({count: _, _}), Start | Resume)
| (Paused(_), Pause | Increase | Decrease)

When I want to copy the pattern suggested from this message, copying two lines is not enough. I need to manually insert | at front of the pattern.

You forgot to handle a possible case here, for example: 
- (Running({count: _, _}), Start | Resume)
+| (Running({count: _, _}), Start | Resume)
 | (Paused(_), Pause | Increase | Decrease)

This simple change makes moving lines much easier

@zth
Copy link
Collaborator

zth commented Feb 27, 2024

Looks great! A changelog and we're good to go.

@zth
Copy link
Collaborator

zth commented Feb 29, 2024

Actually, do you want this in v11? If so rebase it to that branch and it can go in v11.1.

@cometkim
Copy link
Member Author

cometkim commented Mar 5, 2024

Umm do you mean the 11.0_release branch?

@zth
Copy link
Collaborator

zth commented Mar 5, 2024

Yes.

@cometkim cometkim changed the base branch from master to 11.0_release March 5, 2024 14:20
@cometkim cometkim marked this pull request as draft March 5, 2024 14:21
@cometkim cometkim force-pushed the chore-partial-match branch from e57b558 to c7077e9 Compare March 5, 2024 15:45
@cometkim cometkim marked this pull request as ready for review March 5, 2024 15:45
@zth zth enabled auto-merge (squash) March 5, 2024 15:49
@zth zth merged commit daf49ba into rescript-lang:11.0_release Mar 5, 2024
13 checks passed
@cometkim cometkim deleted the chore-partial-match branch March 5, 2024 16:03
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.

2 participants