Skip to content

Commit

Permalink
More appropriate fix for #1170.
Browse files Browse the repository at this point in the history
  • Loading branch information
adetaylor committed Nov 2, 2022
1 parent 8417e0e commit cb0a5ca
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion engine/src/conversion/analysis/fun/implicit_constructors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@ pub(super) fn find_constructors_present(
apis: &ApiVec<FnPrePhase1>,
) -> HashMap<QualifiedName, ItemsFound> {
let (explicits, unknown_types) = find_explicit_items(apis);
let enums: HashSet<QualifiedName> = apis
.iter()
.filter_map(|api| match api {
Api::Enum { name, .. } => Some(name.name.clone()),
_ => None,
})
.collect();

// These contain all the classes we've seen so far with the relevant properties on their
// constructors of each kind. We iterate via [`depth_first`], so analyzing later classes
Expand Down Expand Up @@ -222,7 +229,18 @@ pub(super) fn find_constructors_present(
})
};
let get_items_found = |qn: &QualifiedName| -> Option<ItemsFound> {
if let Some(constructor_details) = known_types().get_constructor_details(qn) {
if enums.contains(qn) {
Some(ItemsFound {
default_constructor: SpecialMemberFound::NotPresent,
destructor: SpecialMemberFound::Implicit,
const_copy_constructor: SpecialMemberFound::Implicit,
non_const_copy_constructor: SpecialMemberFound::NotPresent,
move_constructor: SpecialMemberFound::Implicit,
name: Some(name.clone()),
})
} else if let Some(constructor_details) =
known_types().get_constructor_details(qn)
{
Some(known_type_items_found(constructor_details))
} else {
all_items_found.get(qn).cloned()
Expand Down

0 comments on commit cb0a5ca

Please sign in to comment.