Skip to content

Conversation

@kfc35
Copy link

@kfc35 kfc35 commented Nov 20, 2025

A continuation of #4283
Closes #2569

To resolve some loose threads from the previous pull request’s comments:

  • I took Louis’s advice to use the mod_config (produced from find_package_config_for_module or root_config) to test whether a module is internal, so I removed the new is_internal function the previous author put in and was suggested in the initial task discussion. Let me know if this is not the right way to go about it and the original comment was correct.
  • I did some refactoring to pull out the actual WarningEmitter used that manages the counter for the number of warnings as asked for and interpreted by me. I think I did this correctly, but if I misinterpreted this request or its usage, please let me know.
  • I added snapshot tests for the Warnings, but I did not know if you wanted something more integration-y (i.e. create some test package/dependencies and test for the specific warnings like some of the other tests in the repo).
  • The “internal module” warning should not be emitted if the module is in the root package now (if the logic I wrote is correct)

I’m very new to Rust and Gleam, so apologies in advance if something is completely off base.

I would be curious to know how I can test any compiler changes locally and manually with a Gleam project. If there is documentation somewhere, please share.

@kfc35 kfc35 changed the title Warnings for running a deprecated or an internal module main function Adds Warnings for running a deprecated or an internal module main function Nov 20, 2025
// warning_emitter.emit also increments a counter. However, we only want to
// increment that counter for root package warnings. For dependencies,
// we just print the warning directly to console.
match package_kind {
Copy link
Author

Choose a reason for hiding this comment

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

just highlighting this section to see if this logic is correct re: warning emitter usage

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.

Warn of running a deprecated or internal module main function

2 participants