Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
* typecheck/rust-tyty.cc (ADTType::is_concrete): need to consider if is a num_variant
* typecheck/rust-tyty.h: refactor to cc file
return identifier + subst_as_string () + "{" + variants_buffer + "}";
}
+bool
+ADTType::is_concrete () const
+{
+ if (is_unit ())
+ {
+ return !needs_substitution ();
+ }
+
+ for (auto &variant : variants)
+ {
+ bool is_num_variant
+ = variant->get_variant_type () == VariantDef::VariantType::NUM;
+ if (is_num_variant)
+ continue;
+
+ for (auto &field : variant->get_fields ())
+ {
+ if (!field->is_concrete ())
+ return false;
+ }
+ }
+ return true;
+}
+
bool
ADTType::can_eq (const BaseType *other, bool emit_errors) const
{
return identifier + subst_as_string ();
}
- bool is_concrete () const override final
- {
- if (is_unit ())
- {
- return !needs_substitution ();
- }
-
- for (auto &variant : variants)
- {
- for (auto &field : variant->get_fields ())
- {
- if (!field->is_concrete ())
- return false;
- }
- }
- return true;
- }
+ bool is_concrete () const override final;
BaseType *clone () const final override;
BaseType *monomorphized_clone () const final override;