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

Canvas2D style type doesn't work as intended #95

Open
TheSpyder opened this issue Feb 3, 2022 · 0 comments
Open

Canvas2D style type doesn't work as intended #95

TheSpyder opened this issue Feb 3, 2022 · 0 comments

Comments

@TheSpyder
Copy link
Owner

TheSpyder commented Feb 3, 2022

https://github.com/tinymce/rescript-webapi/blob/55f4010c35c6b1f1c9301ba3e47120dacdb5587a/tests/Webapi/Canvas/Webapi__Canvas__Canvas2d__test.res#L27-L37

In this context, s is not a string. The compiler requires it to be gradient. It also requires the _ of the third match to be a gradient. It warns if there are not 3 patterns in the switch statement, but the second element in the tuple of all 3 take on the variable type of the first. This can be proven by swapping the first and second patterns, which then fails because g is not a string.

I like the idea of using a witness type but this seems to be unusable.

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

No branches or pull requests

1 participant