Skip to content

Commit e7a27f2

Browse files
committed
Fixing test errors
1 parent 2a688c5 commit e7a27f2

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

crates/semantic-analysis/src/symbol_table.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ impl SymbolTable {
324324
let file_symbols = self
325325
.file_symbols
326326
.entry(file_path)
327-
.or_insert_with(HashMap::new);
327+
.or_default();
328328
for (name, symbol) in symbols {
329329
file_symbols.insert(name, symbol);
330330
}
@@ -354,11 +354,12 @@ impl SymbolTable {
354354

355355
/// Get statistics about the symbol table
356356
pub fn get_statistics(&self) -> SymbolTableStats {
357-
let mut stats = SymbolTableStats::default();
358-
359-
stats.total_symbols = self.global_symbols.len();
360-
stats.total_scopes = self.scoped_symbols.len();
361-
stats.total_files = self.file_symbols.len();
357+
let mut stats = SymbolTableStats {
358+
total_symbols: self.global_symbols.len(),
359+
total_scopes: self.scoped_symbols.len(),
360+
total_files: self.file_symbols.len(),
361+
..Default::default()
362+
};
362363

363364
// Count symbols by kind
364365
for symbols in self.file_symbols.values() {

crates/semantic-analysis/src/type_dependency_graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl TypeDependencyGraphBuilder {
180180
}
181181

182182
// Add generic parameter dependencies
183-
for (_param_name, constraints) in &extracted_type.generic_constraints {
183+
for constraints in extracted_type.generic_constraints.values() {
184184
for constraint in constraints {
185185
self.add_relationship(
186186
type_name,

crates/semantic-analysis/src/type_extractor.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,9 @@ impl TypeExtractor {
431431
.clone();
432432

433433
let visibility = self.extract_visibility(node);
434-
let is_static = node.metadata.attributes.get("static").is_some();
435-
let is_final = node.metadata.attributes.get("final").is_some()
436-
|| node.metadata.attributes.get("const").is_some();
434+
let is_static = node.metadata.attributes.contains_key("static");
435+
let is_final = node.metadata.attributes.contains_key("final")
436+
|| node.metadata.attributes.contains_key("const");
437437

438438
let field_info = FieldInfo {
439439
name: name.clone(),
@@ -496,9 +496,9 @@ impl TypeExtractor {
496496
.clone();
497497

498498
let visibility = self.extract_visibility(node);
499-
let is_static = node.metadata.attributes.get("static").is_some();
500-
let is_abstract = node.metadata.attributes.get("abstract").is_some();
501-
let _is_final = node.metadata.attributes.get("final").is_some();
499+
let is_static = node.metadata.attributes.contains_key("static");
500+
let is_abstract = node.metadata.attributes.contains_key("abstract");
501+
let _is_final = node.metadata.attributes.contains_key("final");
502502

503503
// Extract parameters
504504
let parameters = self.extract_method_parameters(node)?;

crates/semantic-analysis/src/type_system.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,10 @@ impl TypeSignature {
255255
self.modifiers = modifiers;
256256
self
257257
}
258+
}
258259

259-
/// Convert to string representation
260-
pub fn to_string(&self) -> String {
260+
impl std::fmt::Display for TypeSignature {
261+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
261262
let mut result = self.base_type.clone();
262263

263264
// Add generic parameters
@@ -276,9 +277,11 @@ impl TypeSignature {
276277
result.push('?');
277278
}
278279

279-
result
280+
write!(f, "{}", result)
280281
}
282+
}
281283

284+
impl TypeSignature {
282285
/// Parse type signature from string
283286
pub fn parse(type_str: &str) -> Result<Self, String> {
284287
let mut signature = TypeSignature::new(String::new());
@@ -326,7 +329,7 @@ impl TypeSignature {
326329
let mut current_param = String::new();
327330
let mut depth = 0;
328331

329-
while let Some(ch) = chars.next() {
332+
for ch in chars.by_ref() {
330333
match ch {
331334
'>' if depth == 0 => break,
332335
'<' => {

0 commit comments

Comments
 (0)