Skip to content

Commit 0228c0c

Browse files
committed
Minor cleanups to address @slava_pestov's feedback
1 parent c250acf commit 0228c0c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/AST/ArchetypeBuilder.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,11 @@ Type ArchetypeBuilder::PotentialArchetype::getTypeInContext(
546546

547547
// Local function to check whether we have a generic parameter that has
548548
// already been recorded
549-
auto getAlreadyRecoveredGenericParam = [&]() -> Optional<Type> {
550-
if (!isGenericParam()) return None;
549+
auto getAlreadyRecoveredGenericParam = [&]() -> Type {
550+
if (!isGenericParam()) return Type();
551551

552552
auto type = genericEnv->getMappingIfPresent(getGenericParamKey());
553-
if (!type) return None;
553+
if (!type) return Type();
554554

555555
// We already have a mapping for this generic parameter in the generic
556556
// environment. Return it.
@@ -610,7 +610,7 @@ Type ArchetypeBuilder::PotentialArchetype::getTypeInContext(
610610
// We will build the archetype below.
611611
assocType = getResolvedAssociatedType();
612612
} else if (auto result = getAlreadyRecoveredGenericParam()) {
613-
return *result;
613+
return result;
614614
}
615615

616616
// Determine the superclass for the archetype. If it exists and involves
@@ -627,7 +627,7 @@ Type ArchetypeBuilder::PotentialArchetype::getTypeInContext(
627627
// We might have recursively recorded the archetype; if so, return early.
628628
// FIXME: This should be detectable before we end up building archetypes.
629629
if (auto result = getAlreadyRecoveredGenericParam())
630-
return *result;
630+
return result;
631631
}
632632

633633
// Build a new archetype.

lib/IRGen/GenMeta.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4707,7 +4707,7 @@ namespace {
47074707
CanType getParentType() const {
47084708
Type type = Target->getDeclaredTypeInContext();
47094709
Type parentType = type->getNominalParent();
4710-
return parentType ? parentType->getCanonicalType() : CanType();
4710+
return parentType.getCanonicalTypeOrNull();
47114711
}
47124712

47134713
public:

0 commit comments

Comments
 (0)