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

Remove compiler warnings when compiled with 0.14 #22

Merged
merged 5 commits into from
Feb 26, 2021

Conversation

cmkarlsson
Copy link

Removing compiler warnings from gleam/otp when compiled with gleam 0.14.

Some comments:

  • The changes in supervisor.gleam is due to a bug (Compiler warns of variable not used when alternative case clauses are present gleam#989)
  • The problem with unused warning for import gleam/opt/port.{Port} might mask another problem. Port is used as a constructor in another type in the module but it is actually port.Port that should be used (I think). I'd expect the compiler to fail here because of ambiguous use of types. I worked around the warning by using the type explicitly
  • I am unsure of the changes process_test.gleam relating to ExitStatus. As a quick workaround I add the ExitStatus to the open_port function. It passes the unit tests but I don't know if there are any side effects. The ExitStatus flags makes the port send an exit status command to the port process when the external command exits. An alternative could be to remove the PortSetting type completely and just send an empty list. To some degree I don't know if I agree with the warning as it is quite nice to be able to document all the options in a type even if you are not using them. Perhaps it doesn't matter much for a test module and that you normally would use a public type in this case.

I've done the changes in separate commits based on the comments above, if anything need amending.

The rewrite is needed because of gleam-lang/gleam#989
Once the above issue is fixed this can be rewritten
as an alternative case clause again.
The compiler complains that the imported Port variable
is unused. The problem stems from Port being shadowed by
a local type constructor. Explicitly use port.Port where
appropriate
@lpil
Copy link
Member

lpil commented Feb 26, 2021

Thank you for this, I have not forgotten about this PR! I'm waiting a little bit until I have time to investigate the issues you've found here, should be soon

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Wonderful, thank you. I've also fixed the bugs you've discovered. Your detailed bug reports helped a lot

@lpil lpil merged commit d9c79cd into gleam-lang:main Feb 26, 2021
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