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 unused-var warning with polyvars without own cases #38

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jchavarri
Copy link
Member

The case type poly = [ one | other ] triggers a:

Warning 26 [unused-var]: unused variable tag.

on the js generated code. This PR fixes it.

  • The first commit adds a test to show the generated code as is in main
  • The second commit fixes the problem and updates the test. The fix is just move the let tag definition inside the polyvar body expr

if Stdlib.( > ) len 0 then
let tag = Js.Array.unsafe_get array 0 in
if Stdlib.( = ) (Js.typeof tag) "string" then
let tag = (Obj.magic tag : string) in
Copy link
Member Author

Choose a reason for hiding this comment

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

Here was the problem: tag is never used below.

@andreypopp
Copy link
Collaborator

Let’s land #32 first.

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