Skip to content

Commit 9458e52

Browse files
committed
git clang-format
1 parent 4330aa2 commit 9458e52

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6977,16 +6977,15 @@ void TypeChecker::checkExistentialTypes(
69776977
}
69786978

69796979
/// Retrieves the valid result types of the result builder
6980-
/// (the return types of `buildFinalResult` / `buildBlock` / `buildPartialResult`).
6981-
llvm::SmallVector<Type, 4> retrieveResultBuilderResultTypes(NominalTypeDecl *builder) {
6980+
/// (the return types of `buildFinalResult` / `buildBlock` /
6981+
/// `buildPartialResult`).
6982+
llvm::SmallVector<Type, 4>
6983+
retrieveResultBuilderResultTypes(NominalTypeDecl *builder) {
69826984
ASTContext &ctx = builder->getASTContext();
69836985
llvm::SmallVector<Type, 4> resultTypes;
69846986

6985-
Identifier methodIds[] = {
6986-
ctx.Id_buildFinalResult,
6987-
ctx.Id_buildBlock,
6988-
ctx.Id_buildPartialBlock
6989-
};
6987+
Identifier methodIds[] = {ctx.Id_buildFinalResult, ctx.Id_buildBlock,
6988+
ctx.Id_buildPartialBlock};
69906989

69916990
for (auto methodId : methodIds) {
69926991
SmallVector<ValueDecl *, 4> potentialMatches;
@@ -7020,7 +7019,7 @@ llvm::SmallVector<Type, 4> retrieveResultBuilderResultTypes(NominalTypeDecl *bui
70207019
}
70217020
}
70227021
}
7023-
7022+
70247023
return resultTypes;
70257024
}
70267025

@@ -7039,11 +7038,12 @@ Type invalidResultBuilderType(UnboundGenericType* unboundTy,
70397038
/// result type and the return type of the attached declaration.
70407039
Type openUnboundResultBuilderType(UnboundGenericType* unboundTy,
70417040
CustomAttr *attr, DeclContext *dc) {
7042-
auto resultBuilderDecl = dyn_cast_or_null<NominalTypeDecl>(unboundTy->getDecl());
7041+
auto resultBuilderDecl =
7042+
dyn_cast_or_null<NominalTypeDecl>(unboundTy->getDecl());
70437043
if (!resultBuilderDecl) {
70447044
return invalidResultBuilderType(unboundTy, attr, dc);
70457045
}
7046-
7046+
70477047
// Retrieve the return type of the owning declaration that
70487048
// provides type inference for the result builder type.
70497049
Type owningDeclResultType;
@@ -7077,41 +7077,40 @@ Type openUnboundResultBuilderType(UnboundGenericType* unboundTy,
70777077

70787078
// Create a type variable for each of the result builder's generic params
70797079
llvm::SmallVector<Type, 8> typeVarReplacements;
7080-
llvm::SmallVector<TypeVariableType*, 8> typeVars;
7080+
llvm::SmallVector<TypeVariableType *, 8> typeVars;
70817081
for (unsigned i = 0; i < genericSig.getGenericParams().size(); ++i) {
70827082
auto locator = cs.getConstraintLocator(
7083-
resultBuilderDecl,
7084-
{ConstraintLocator::GenericArgument, i});
7083+
resultBuilderDecl, {ConstraintLocator::GenericArgument, i});
70857084
auto typeVar = cs.createTypeVariable(locator, TVO_CanBindToHole);
70867085
typeVarReplacements.push_back(typeVar);
70877086
typeVars.push_back(typeVar);
70887087
}
70897088

70907089
// Replace any references to the result builder's generic params
70917090
// in the result type with the corresponding type variables.
7092-
auto subMap = SubstitutionMap::get(
7093-
genericSig,
7094-
typeVarReplacements,
7095-
LookUpConformanceInModule());
7091+
auto subMap = SubstitutionMap::get(genericSig, typeVarReplacements,
7092+
LookUpConformanceInModule());
70967093

70977094
auto componentTypeWithTypeVars = componentType.subst(subMap);
70987095

7099-
// The result builder result type should be equal to the return type of the attached declaration.
7100-
cs.addConstraint(ConstraintKind::Equal,
7101-
owningDeclResultType,
7096+
// The result builder result type should be equal to the return type of the
7097+
// attached declaration.
7098+
cs.addConstraint(ConstraintKind::Equal, owningDeclResultType,
71027099
componentTypeWithTypeVars,
71037100
/*preparedOverload:*/ nullptr);
71047101

71057102
auto solution = cs.solveSingle();
71067103

7107-
// If a solution exists, bind the result builder's generic params to the solved types.
7104+
// If a solution exists, bind the result builder's generic params to the
7105+
// solved types.
71087106
if (solution) {
71097107
llvm::SmallVector<Type, 8> solvedReplacements;
71107108
for (auto typeVar : typeVars) {
71117109
solvedReplacements.push_back(solution->typeBindings[typeVar]);
71127110
}
71137111

7114-
return BoundGenericType::get(resultBuilderDecl, unboundTy->getParent(), solvedReplacements);
7112+
return BoundGenericType::get(resultBuilderDecl, unboundTy->getParent(),
7113+
solvedReplacements);
71157114
}
71167115
}
71177116

@@ -7125,7 +7124,6 @@ Type CustomAttrTypeRequest::evaluate(Evaluator &eval, CustomAttr *attr,
71257124
const TypeResolutionOptions options(TypeResolverContext::PatternBindingDecl);
71267125

71277126
OpenUnboundGenericTypeFn unboundTyOpener = nullptr;
7128-
HandlePlaceholderTypeReprFn placeholderHandler = nullptr;
71297127

71307128
// Property delegates allow their type to be an unbound generic.
71317129
if (typeKind == CustomAttrTypeKind::PropertyWrapper) {
@@ -7138,13 +7136,11 @@ Type CustomAttrTypeRequest::evaluate(Evaluator &eval, CustomAttr *attr,
71387136
unboundTyOpener = [attr, dc](UnboundGenericType* unboundTy) -> Type {
71397137
return openUnboundResultBuilderType(unboundTy, attr, dc);
71407138
};
7141-
7142-
placeholderHandler = PlaceholderType::get;
71437139
}
71447140

71457141
const auto type = TypeResolution::resolveContextualType(
71467142
attr->getTypeRepr(), dc, options, unboundTyOpener,
7147-
placeholderHandler, /*packElementOpener*/ nullptr);
7143+
/*placeholderHandler*/ nullptr, /*packElementOpener*/ nullptr);
71487144

71497145
// We always require the type to resolve to a nominal type. If the type was
71507146
// not a nominal type, we should have already diagnosed an error via

0 commit comments

Comments
 (0)