Skip to content

@notUndefined attribute for abstract types #7458

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

Merged
merged 9 commits into from
May 12, 2025

Conversation

cknitt
Copy link
Member

@cknitt cknitt commented May 10, 2025

Implement an attribute for abstract types which is a cleaner solution than the

type t = private {}

hack.

@cknitt cknitt requested review from cristianoc and zth May 10, 2025 08:35
Copy link

pkg-pr-new bot commented May 10, 2025

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7458

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7458

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7458

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7458

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7458

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7458

commit: cc8754e

@zth
Copy link
Collaborator

zth commented May 10, 2025

Awesome! Could you also raise an error when it's used on a non-abstract type?

@zth
Copy link
Collaborator

zth commented May 10, 2025

Should probably also add it to the editor tooling in the decorators file.

@cknitt cknitt force-pushed the not-undefined branch 3 times, most recently from 68a9ef0 to 299d58a Compare May 10, 2025 16:36
@rescript-lang rescript-lang deleted a comment May 10, 2025
@rescript-lang rescript-lang deleted a comment May 10, 2025
@rescript-lang rescript-lang deleted a comment May 10, 2025
@rescript-lang rescript-lang deleted a comment May 10, 2025
@rescript-lang rescript-lang deleted a comment May 10, 2025
@rescript-lang rescript-lang deleted a comment May 10, 2025
@rescript-lang rescript-lang deleted a comment May 10, 2025
@rescript-lang rescript-lang deleted a comment May 10, 2025
@cknitt
Copy link
Member Author

cknitt commented May 10, 2025

@zth Done!

@zth
Copy link
Collaborator

zth commented May 10, 2025

@cristianoc any thoughts?

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.

Looks good.
Are we happy about the name?
Nit: perhaps define the string constant separately to avoid repeating it in the code.
Would we support the lowercase version too, or rely on the camel case version spelling to be correct?

@cknitt
Copy link
Member Author

cknitt commented May 11, 2025

Nit: perhaps define the string constant separately to avoid repeating it in the code.

Done (extracted helper function).

Would we support the lowercase version too, or rely on the camel case version spelling to be correct?

I feel it is ok to rely on correct camel case spelling.

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.

merge away!

@cknitt cknitt merged commit ca03c17 into rescript-lang:master May 12, 2025
22 checks passed
@cknitt cknitt deleted the not-undefined branch May 12, 2025 08:32
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.

3 participants