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

Fix shadowing Js.Json.t with type kind #6317

Merged
merged 7 commits into from
Jul 4, 2023
Merged

Conversation

mununki
Copy link
Member

@mununki mununki commented Jul 1, 2023

This PR fixes an issue with existing Js.Json.kind types shadowing the variant constructor of Js.Json.t types.

@mununki mununki requested a review from zth July 1, 2023 10:54
Copy link
Collaborator

@zth zth left a comment

Choose a reason for hiding this comment

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

This looks good to me. @cristianoc any thoughts?

| Boolean: kind<bool>
| Null: kind<Js_types.null_val>
module Kind = {
type rec kind<_> =
Copy link
Collaborator

Choose a reason for hiding this comment

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

s / kind / t

Copy link
Member Author

Choose a reason for hiding this comment

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

I picked s. 7a8880b

CHANGELOG.md Outdated
@@ -14,6 +14,9 @@
#### :rocket: New Feature
- Variants: Allow coercing from variant to variant, where applicable. https://github.com/rescript-lang/rescript-compiler/pull/6314

#### :boom: Breaking Change
- Fixed Js.Json.kind type shadowing Js.Json.t type: `type kind<_>` -> `type Kind.kind<_>` https://github.com/rescript-lang/rescript-compiler/pull/6317
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should say what the breaking change is and what is the fix for someone relying on the previous behaviour.

Copy link
Member Author

Choose a reason for hiding this comment

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

| Boolean: kind<bool>
| Null: kind<Js_types.null_val>
module Kind = {
type rec s<_> =
Copy link
Collaborator

Choose a reason for hiding this comment

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

s/ s / t

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure I understand your notation, but

s / kind / t 695bb47

CHANGELOG.md Outdated
@@ -14,6 +14,9 @@
#### :rocket: New Feature
- Variants: Allow coercing from variant to variant, where applicable. https://github.com/rescript-lang/rescript-compiler/pull/6314

#### :boom: Breaking Change
- Fixed the issue of name collision between the newly defined Js.Json.t and the variant constructor in the existing Js.Json.kind type. To address this, the usage of the existing Js.Json.kind type can be updated to Js.Json.Kind.s. https://github.com/rescript-lang/rescript-compiler/pull/6317
Copy link
Collaborator

Choose a reason for hiding this comment

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

s / s / t

Copy link
Member Author

Choose a reason for hiding this comment

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

s / kind / t 7f3959d

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why it's not t?

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought it's idiomatic for types

Copy link
Collaborator

Choose a reason for hiding this comment

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

It ended up being t, s was just a confusion.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is t.

type t

module Kind = {
  type json = t
  type t
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I see 😁

@mununki mununki merged commit 9040d1e into master Jul 4, 2023
6 of 7 checks passed
@mununki mununki deleted the fix-shadowing-json-t branch July 4, 2023 15:41
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