Skip to content

Commit 53eb5e0

Browse files
Frank-IIIlpil
authored andcommittedDec 4, 2024·
fix naming
1 parent bb47e3a commit 53eb5e0

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed
 

‎compiler-core/src/analyse/imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl<'context, 'problems> Importer<'context, 'problems> {
152152
module_name: module.name.clone(),
153153
value_constructors: module.public_value_names(),
154154
type_with_same_name: module.get_public_type(import_name).is_some(),
155-
context: crate::type_::error::ModuleValueErrorContext::UnqualifiedImport,
155+
context: crate::type_::error::ModuleValueUsageContext::UnqualifiedImport,
156156
});
157157
return;
158158
}

‎compiler-core/src/error.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use crate::build::{Outcome, Runtime, Target};
33
use crate::diagnostic::{Diagnostic, ExtraLabel, Label, Location};
44
use crate::type_::error::{
5-
MissingAnnotation, ModuleValueErrorContext, Named, UnknownField, UnknownTypeHint,
5+
MissingAnnotation, ModuleValueUsageContext, Named, UnknownField, UnknownTypeHint,
66
UnsafeRecordUpdateReason,
77
};
88
use crate::type_::printer::{Names, Printer};
@@ -2232,9 +2232,9 @@ Private types can only be used within the module that defines them.",
22322232
} => {
22332233
let text = if *imported_value_as_type {
22342234
match context {
2235-
ModuleValueErrorContext::UnqualifiedImport =>
2235+
ModuleValueUsageContext::UnqualifiedImport =>
22362236
wrap_format!("`{name}` is only a type, it cannot be imported as a value."),
2237-
ModuleValueErrorContext::ModuleAccess =>
2237+
ModuleValueUsageContext::ModuleAccess =>
22382238
wrap_format!("{module_name}.{name} is a type constructor, it cannot be used as a value"),
22392239
}
22402240
} else {
@@ -2247,7 +2247,7 @@ Private types can only be used within the module that defines them.",
22472247
level: Level::Error,
22482248
location: Some(Location {
22492249
label: Label {
2250-
text: if *imported_value_as_type && matches!(context, ModuleValueErrorContext::UnqualifiedImport) {
2250+
text: if *imported_value_as_type && matches!(context, ModuleValueUsageContext::UnqualifiedImport) {
22512251
Some(format!("Did you mean `type {name}`?"))
22522252
} else {
22532253
did_you_mean(name, value_constructors)

‎compiler-core/src/type_/error.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pub enum Error {
201201
module_name: EcoString,
202202
value_constructors: Vec<EcoString>,
203203
type_with_same_name: bool,
204-
context: ModuleValueErrorContext,
204+
context: ModuleValueUsageContext,
205205
},
206206

207207
ModuleAliasUsedAsName {
@@ -585,7 +585,7 @@ pub enum Error {
585585
}
586586

587587
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
588-
pub enum ModuleValueErrorContext {
588+
pub enum ModuleValueUsageContext {
589589
UnqualifiedImport,
590590
ModuleAccess,
591591
}
@@ -1142,7 +1142,7 @@ pub fn convert_get_value_constructor_error(
11421142
module_name,
11431143
value_constructors,
11441144
type_with_same_name: imported_value_as_type,
1145-
context: ModuleValueErrorContext::ModuleAccess,
1145+
context: ModuleValueUsageContext::ModuleAccess,
11461146
},
11471147
}
11481148
}

‎compiler-core/src/type_/expression.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2225,7 +2225,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
22252225
module_name: module.name.clone(),
22262226
value_constructors: module.public_value_names(),
22272227
type_with_same_name: module.get_public_type(&label).is_some(),
2228-
context: ModuleValueErrorContext::ModuleAccess,
2228+
context: ModuleValueUsageContext::ModuleAccess,
22292229
})?;
22302230

22312231
// Emit a warning if the value being used is deprecated.
@@ -2787,7 +2787,7 @@ impl<'a, 'b> ExprTyper<'a, 'b> {
27872787
name: name.clone(),
27882788
value_constructors: module.public_value_names(),
27892789
type_with_same_name: module.get_public_type(name).is_some(),
2790-
context: ModuleValueErrorContext::ModuleAccess,
2790+
context: ModuleValueUsageContext::ModuleAccess,
27912791
})?
27922792
}
27932793
};

0 commit comments

Comments
 (0)
Please sign in to comment.