Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

jsx: allow locally abstract types and type constraints on @react.component definitions #487

Merged
merged 2 commits into from
May 7, 2022

Conversation

glennsl
Copy link
Contributor

@glennsl glennsl commented May 7, 2022

No description provided.

Copy link
Contributor

@IwanKaramazow IwanKaramazow left a comment

Choose a reason for hiding this comment

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

👍

@IwanKaramazow IwanKaramazow merged commit fab78d4 into rescript-lang:master May 7, 2022
@glennsl glennsl deleted the feat/jsx/allow-newtypes branch May 7, 2022 20:34
@@ -0,0 +1,6 @@
@obj external makeProps: (~a: a, ~b: 'b, ~key: string=?, unit) => {"a": a, "b": 'b} = ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Note this won't compile: type a.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the transform is incorrect. Will revert.

Copy link
Contributor

Choose a reason for hiding this comment

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

@glennsl reverted the PR for now, we'll need a new PR with a fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Crap. Shouldn't have assumed the tests were run through the compiler. I'll fix. I suspect this will make it a much more invasive change though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we also have a concrete piece of UI code to verify the result?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can certainly make one. Is there anywhere I can put this, or do you just want something to test manually on the side?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a gist is ok, we don't have "full stack integration tests", so manual it is.

@cristianoc
Copy link
Contributor

This one won't compile:

@react.component
let make = (type a, ~a: a, ~b, _) => <div />

gives

FAILED: src/Demo.cmj

  We've found a bug for you!
  /Users/cristianocalcagno/GitHub/rescript-compiler/foo/src/Demo.res:5:25

  3 │ 
  4 │ @react.component
  5 │ let make = (type a, ~a: a, ~b, _) => <div />
  6 │  
  7 │ 

  This type constructor, `a`, can't be found.

IwanKaramazow pushed a commit that referenced this pull request May 8, 2022
…act.component definitions (#487)"

This reverts commit fab78d4.
IwanKaramazow added a commit that referenced this pull request May 8, 2022
…act.component definitions (#487)" (#488)

This reverts commit fab78d4.

Co-authored-by: Maxim <mvalcke@hubspot.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants