Skip to content

Commit 6a3c43b

Browse files
committed
Clarify that Optionals are handled separately from Enums
1 parent 7e66535 commit 6a3c43b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

stdlib/public/runtime/DynamicCast.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ tryCastToEnum(
533533
bool takeOnSuccess, bool mayDeferChecks)
534534
{
535535
assert(srcType != destType);
536+
// Note: Optional is handled elsewhere
536537
assert(destType->getKind() == MetadataKind::Enum);
537538

538539
// Enum has no special cast support at present.
@@ -900,6 +901,8 @@ tryCastToOptional(
900901
assert(destType->getKind() == MetadataKind::Optional);
901902

902903
// Nothing to do for the basic casting operation.
904+
// Unwrapping is handled by top-level tryCast with assistance
905+
// from utility functions below.
903906

904907
return DynamicCastResult::Failure;
905908
}

0 commit comments

Comments
 (0)