Skip to content

Commit

Permalink
total mess
Browse files Browse the repository at this point in the history
  • Loading branch information
cburgdorf committed May 5, 2022
1 parent aef8fa7 commit e240f26
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions crates/analyzer/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ impl Location {
| FixedSize::Tuple(_)
| FixedSize::String(_)
| FixedSize::Struct(_) => Location::Memory,
// This feels wrong on so many levels
FixedSize::GenericPlaceholder => Location::Value,
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions crates/analyzer/src/namespace/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,10 @@ impl FunctionId {
self.data(db).ast.kind.name.span
}

pub fn is_generic(&self, db: &dyn AnalyzerDb) -> bool {
!self.data(db).ast.kind.generic_params.kind.is_empty()
}

// This should probably be scrapped in favor of `parent(`
pub fn class(&self, db: &dyn AnalyzerDb) -> Option<Class> {
self.data(db).parent
Expand Down
2 changes: 2 additions & 0 deletions crates/analyzer/src/namespace/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub enum FixedSize {
String(FeString),
Contract(Contract),
Struct(Struct),
// Indicating a value that isn't yet determined but will be replaced with a FixedSize after lowering
GenericPlaceholder,
}

#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
Expand Down
12 changes: 7 additions & 5 deletions crates/analyzer/src/traversal/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,13 @@ pub fn resolve_concrete_type_named_thing<T: std::fmt::Display>(
},
vec![],
))),
None => Err(TypeError::new(context.error(
"undefined type",
base_desc.span,
&format!("`{}` has not been defined", base_desc.kind),
))),
None => {
return Err(TypeError::new(context.error(
"undefined type",
base_desc.span,
&format!("`{}` has not been defined", base_desc.kind),
)))
}
}
}

Expand Down

0 comments on commit e240f26

Please sign in to comment.