@@ -46,10 +46,6 @@ TypeCheckEnumItem::Resolve (HIR::EnumItem &item, int64_t last_discriminant)
46
46
case HIR::EnumItem::EnumItemKind::Struct:
47
47
resolver.visit (static_cast <HIR::EnumItemStruct &> (item));
48
48
break ;
49
-
50
- case HIR::EnumItem::EnumItemKind::Discriminant:
51
- resolver.visit (static_cast <HIR::EnumItemDiscriminant &> (item));
52
- break ;
53
49
}
54
50
return resolver.variant ;
55
51
}
@@ -104,51 +100,6 @@ TypeCheckEnumItem::visit (HIR::EnumItem &item)
104
100
std::move (discim_expr));
105
101
}
106
102
107
- void
108
- TypeCheckEnumItem::visit (HIR::EnumItemDiscriminant &item)
109
- {
110
- if (last_discriminant == INT64_MAX)
111
- rust_error_at (item.get_locus (), " discriminant too big" );
112
-
113
- auto &discriminant = item.get_discriminant_expression ();
114
- auto capacity_type = TypeCheckExpr::Resolve (discriminant);
115
- if (capacity_type->get_kind () == TyTy::TypeKind::ERROR)
116
- return ;
117
-
118
- TyTy::ISizeType *expected_ty
119
- = new TyTy::ISizeType (discriminant.get_mappings ().get_hirid ());
120
- context->insert_type (discriminant.get_mappings (), expected_ty);
121
-
122
- unify_site (item.get_mappings ().get_hirid (),
123
- TyTy::TyWithLocation (expected_ty),
124
- TyTy::TyWithLocation (capacity_type), item.get_locus ());
125
-
126
- tl::optional<CanonicalPath> canonical_path;
127
-
128
- if (flag_name_resolution_2_0)
129
- {
130
- auto &nr_ctx
131
- = Resolver2_0::ImmutableNameResolutionContext::get ().resolver ();
132
-
133
- canonical_path
134
- = nr_ctx.types .to_canonical_path (item.get_mappings ().get_nodeid ());
135
- }
136
- else
137
- {
138
- canonical_path
139
- = mappings.lookup_canonical_path (item.get_mappings ().get_nodeid ());
140
- }
141
-
142
- rust_assert (canonical_path.has_value ());
143
-
144
- RustIdent ident{*canonical_path, item.get_locus ()};
145
- variant
146
- = new TyTy::VariantDef (item.get_mappings ().get_hirid (),
147
- item.get_mappings ().get_defid (),
148
- item.get_identifier ().as_string (), ident,
149
- item.get_discriminant_expression ().clone_expr ());
150
- }
151
-
152
103
void
153
104
TypeCheckEnumItem::visit (HIR::EnumItemTuple &item)
154
105
{
0 commit comments