Skip to content

Commit 780dd3a

Browse files
authored
Remove mistaken asserts and add regression test (#4424)
1 parent 5bdeb01 commit 780dd3a

File tree

3 files changed

+218
-54
lines changed

3 files changed

+218
-54
lines changed

toolchain/check/convert.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -939,21 +939,18 @@ auto Convert(Context& context, SemIR::LocId loc_id, SemIR::InstId expr_id,
939939
if (!context.TryToCompleteType(
940940
target.type_id,
941941
[&] {
942-
CARBON_DIAGNOSTIC(IncompleteTypeInInit, Error,
943-
"initialization of incomplete type {0}",
944-
SemIR::TypeId);
942+
CARBON_CHECK(!target.is_initializer(),
943+
"Initialization of incomplete types is expected to be "
944+
"caught elsewhere.");
945945
CARBON_DIAGNOSTIC(IncompleteTypeInValueConversion, Error,
946946
"forming value of incomplete type {0}",
947947
SemIR::TypeId);
948948
CARBON_DIAGNOSTIC(IncompleteTypeInConversion, Error,
949949
"invalid use of incomplete type {0}",
950950
SemIR::TypeId);
951-
assert(!target.is_initializer());
952-
assert(target.kind == ConversionTarget::Value);
953951
return context.emitter().Build(
954952
loc_id,
955-
target.is_initializer() ? IncompleteTypeInInit
956-
: target.kind == ConversionTarget::Value
953+
target.kind == ConversionTarget::Value
957954
? IncompleteTypeInValueConversion
958955
: IncompleteTypeInConversion,
959956
target.type_id);

0 commit comments

Comments
 (0)