Skip to content

Commit d77ed7a

Browse files
authored
Merge pull request #27241 from CodaFi/well-i-should-have---run-clang-format
2 parents 00ac8d8 + bddb2c7 commit d77ed7a

File tree

4 files changed

+24
-26
lines changed

4 files changed

+24
-26
lines changed

lib/AST/GenericSignatureBuilder.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3786,12 +3786,13 @@ PotentialArchetype *GenericSignatureBuilder::realizePotentialArchetype(
37863786

37873787
static Type getStructuralType(TypeDecl *typeDecl) {
37883788
if (auto typealias = dyn_cast<TypeAliasDecl>(typeDecl)) {
3789-
// When we're computing requirement signatures, the structural type
3790-
// suffices. Otherwise we'll potentially try to validate incomplete
3791-
// requirements.
3792-
auto *proto = dyn_cast_or_null<ProtocolDecl>(typealias->getDeclContext()->getAsDecl());
3793-
if (proto && proto->isComputingRequirementSignature())
3794-
return typealias->getStructuralType();
3789+
// When we're computing requirement signatures, the structural type
3790+
// suffices. Otherwise we'll potentially try to validate incomplete
3791+
// requirements.
3792+
auto *proto = dyn_cast_or_null<ProtocolDecl>(
3793+
typealias->getDeclContext()->getAsDecl());
3794+
if (proto && proto->isComputingRequirementSignature())
3795+
return typealias->getStructuralType();
37953796
return typealias->getUnderlyingType();
37963797
}
37973798

lib/Sema/TypeCheckDecl.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4302,16 +4302,20 @@ ExtendedTypeRequest::evaluate(Evaluator &eval, ExtensionDecl *ext) const {
43024302
// Nested Hack to break cycles if this is called before validation has
43034303
// finished.
43044304
if (aliasDecl->hasInterfaceType()) {
4305-
auto extendedNominal = aliasDecl->getDeclaredInterfaceType()->getAnyNominal();
4305+
auto extendedNominal =
4306+
aliasDecl->getDeclaredInterfaceType()->getAnyNominal();
43064307
if (extendedNominal)
4307-
return TypeChecker::isPassThroughTypealias(aliasDecl, aliasDecl->getUnderlyingType(), extendedNominal)
4308-
? extendedType
4309-
: extendedNominal->getDeclaredType();
4308+
return TypeChecker::isPassThroughTypealias(
4309+
aliasDecl, aliasDecl->getUnderlyingType(), extendedNominal)
4310+
? extendedType
4311+
: extendedNominal->getDeclaredType();
43104312
} else {
4311-
if (auto ty = aliasDecl->getStructuralType()->getAs<NominalOrBoundGenericNominalType>())
4312-
return TypeChecker::isPassThroughTypealias(aliasDecl, ty, ty->getDecl())
4313-
? extendedType
4314-
: ty->getDecl()->getDeclaredType();
4313+
if (auto ty = aliasDecl->getStructuralType()
4314+
->getAs<NominalOrBoundGenericNominalType>())
4315+
return TypeChecker::isPassThroughTypealias(aliasDecl, ty,
4316+
ty->getDecl())
4317+
? extendedType
4318+
: ty->getDecl()->getDeclaredType();
43154319
}
43164320
}
43174321
}

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,8 @@ static Type formExtensionInterfaceType(
556556
}
557557

558558
// If we have a typealias, try to form type sugar.
559-
if (typealias && TypeChecker::isPassThroughTypealias(typealias, typealias->getUnderlyingType(), nominal)) {
559+
if (typealias && TypeChecker::isPassThroughTypealias(
560+
typealias, typealias->getUnderlyingType(), nominal)) {
560561
auto typealiasSig = typealias->getGenericSignature();
561562
SubstitutionMap subMap;
562563
if (typealiasSig) {
@@ -565,10 +566,10 @@ static Type formExtensionInterfaceType(
565566
mustInferRequirements = true;
566567
}
567568

568-
resultType = TypeAliasType::get(typealias, parentType, subMap,
569-
resultType);
569+
resultType = TypeAliasType::get(typealias, parentType, subMap, resultType);
570570
}
571571

572+
572573
return resultType;
573574
}
574575

lib/Serialization/Deserialization.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,15 +2292,7 @@ class swift::DeclDeserializer {
22922292

22932293
auto underlying = MF.getType(underlyingTypeID);
22942294
alias->setUnderlyingType(underlying);
2295-
SubstitutionMap subs;
2296-
if (genericSig) {
2297-
subs = genericSig->getIdentitySubstitutionMap();
2298-
}
2299-
Type parent;
2300-
if (DC->isTypeContext())
2301-
parent = DC->getDeclaredInterfaceType();
2302-
auto sugaredType = TypeAliasType::get(alias, parent, subs, underlying);
2303-
alias->setInterfaceType(MetatypeType::get(sugaredType, ctx));
2295+
alias->computeType();
23042296
alias->setValidationToChecked();
23052297

23062298
if (auto accessLevel = getActualAccessLevel(rawAccessLevel))

0 commit comments

Comments
 (0)