Skip to content

Commit

Permalink
feat: added warnings for deprecation and usage of internals
Browse files Browse the repository at this point in the history
  • Loading branch information
Lioncat2002 committed Feb 26, 2025
1 parent 56214ef commit 1f6bd92
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion compiler-cli/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,19 @@ fn setup(
};

let built = crate::build::main(paths, options, manifest)?;

if built.is_internal(&module.clone().into()).is_ok(){
let message=format!("The module {} being called is marked as internal",module);
tracing::warn!(message);
}
// A module can not be run if it does not exist or does not have a public main function.
let main_function = get_or_suggest_main_function(built, &module, target)?;

//Warn incase the main function being run has been deprecated
if main_function.deprecation.is_deprecated(){
let message=format!("The main function in module {} has been marked deprecated",module);
tracing::warn!(message);
}

// Don't exit on ctrl+c as it is used by child erlang shell
ctrlc::set_handler(move || {}).expect("Error setting Ctrl-C handler");

Expand Down
4 changes: 2 additions & 2 deletions compiler-core/src/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ impl ModuleValueConstructor {
#[derive(Debug, Clone)]
pub struct ModuleFunction {
pub package: EcoString,
pub is_deprecated: Deprecation
pub deprecation: Deprecation
}

#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down Expand Up @@ -991,7 +991,7 @@ impl ModuleInterface {

Ok(ModuleFunction {
package: self.package.clone(),
is_deprecated: value.deprecation.clone(),
deprecation: value.deprecation.clone(),
})
}

Expand Down

0 comments on commit 1f6bd92

Please sign in to comment.