Skip to content

Commit

Permalink
Revert "generate overridden publicities when analyzing types"
Browse files Browse the repository at this point in the history
This reverts commit 21b3222.
  • Loading branch information
lpil committed Apr 22, 2024
1 parent 543a340 commit 9e59319
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 16 deletions.
9 changes: 1 addition & 8 deletions compiler-core/src/analyse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ use crate::{
};
use camino::Utf8PathBuf;
use ecow::EcoString;
use im::HashSet;
use itertools::Itertools;
use std::{
collections::HashMap,
Expand Down Expand Up @@ -175,7 +174,6 @@ pub fn infer_module<A>(
// We process imports first so that anything imported can be referenced
// anywhere in the module.
let mut env = imports::Importer::run(origin, env, &statements.imports)?;
let mut overridden_publicities = HashSet::new();

// Register types so they can be used in constructors and functions
// earlier in the module.
Expand Down Expand Up @@ -251,8 +249,7 @@ pub fn infer_module<A>(
working_group.push(statement);
}
CallGraphNode::ModuleConstant(c) => {
let statement =
infer_module_constant(c, &mut env, &mut overridden_publicities, &name)?;
let statement = infer_module_constant(c, &mut env, &name)?;
working_group.push(statement);
}
}
Expand Down Expand Up @@ -318,7 +315,6 @@ pub fn infer_module<A>(
documentation,
name: name.clone(),
definitions: typed_statements,
overridden_publicities,
type_info: ModuleInterface {
name,
types,
Expand Down Expand Up @@ -1076,7 +1072,6 @@ fn record_imported_items_for_use_detection<A>(
fn infer_module_constant(
c: ModuleConstant<(), ()>,
environment: &mut Environment<'_>,
overridden_publicities: &mut HashSet<EcoString>,
module_name: &EcoString,
) -> Result<TypedDefinition, Error> {
let ModuleConstant {
Expand Down Expand Up @@ -1126,8 +1121,6 @@ fn infer_module_constant(

if publicity.is_private() {
environment.init_usage(name.clone(), EntityKind::PrivateConstant, location);
} else {
typed_expr.private_fn_deps(overridden_publicities);
}

Ok(Definition::ModuleConstant(ModuleConstant {
Expand Down
2 changes: 0 additions & 2 deletions compiler-core/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use crate::type_::{
use std::sync::Arc;

use ecow::EcoString;
use im::HashSet;
#[cfg(test)]
use pretty_assertions::assert_eq;
use vec1::Vec1;
Expand All @@ -45,7 +44,6 @@ pub struct Module<Info, Statements> {
pub documentation: Vec<EcoString>,
pub type_info: Info,
pub definitions: Vec<Statements>,
pub overridden_publicities: HashSet<EcoString>,
}

impl TypedModule {
Expand Down
2 changes: 1 addition & 1 deletion compiler-core/src/erlang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ fn module_document<'a>(
&mut type_exports,
&mut type_defs,
&module.name,
&module.overridden_publicities,
&overridden_publicity,
);
}

Expand Down
2 changes: 0 additions & 2 deletions compiler-core/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ use crate::type_::expression::Implementations;
use crate::type_::Deprecation;
use ecow::EcoString;
use error::{LexicalError, ParseError, ParseErrorType};
use im::HashSet;
use lexer::{LexResult, Spanned};
use std::cmp::Ordering;
use std::collections::VecDeque;
Expand Down Expand Up @@ -206,7 +205,6 @@ where
documentation: vec![],
type_info: (),
definitions,
overridden_publicities: HashSet::new(),
};
Ok(Parsed {
module,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
source: compiler-core/src/parse/tests.rs
assertion_line: 646
expression: "import wibble.{type Wobble, Wobble, type Wabble}"
---
Parsed {
Expand Down Expand Up @@ -52,7 +53,6 @@ Parsed {
target: None,
},
],
overridden_publicities: {},
},
extra: ModuleExtra {
module_comments: [],
Expand Down
2 changes: 0 additions & 2 deletions compiler-core/src/type_/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::{
warning::{TypeWarningEmitter, VectorWarningEmitterIO, WarningEmitter, WarningEmitterIO},
};
use ecow::EcoString;
use im::HashSet;
use itertools::Itertools;
use std::sync::Arc;
use vec1::Vec1;
Expand Down Expand Up @@ -609,7 +608,6 @@ fn infer_module_type_retention_test() {
name: "ok".into(),
definitions: vec![],
type_info: (),
overridden_publicities: HashSet::new(),
};
let direct_dependencies = std::collections::HashMap::from_iter(vec![]);
let ids = UniqueIdGenerator::new();
Expand Down

0 comments on commit 9e59319

Please sign in to comment.