Skip to content

Commit c4189f3

Browse files
committed
[NFC] Minor edits.
- Fit lines within 80 columns (addresses feedback by @lattner). - Rename `DictionaryLiteral` to `KeyValuePairs`.
1 parent 803dbfb commit c4189f3

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

lib/Sema/CSApply.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7464,8 +7464,8 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
74647464
// We're constructing a value of nominal type. Look for the constructor or
74657465
// enum element to use.
74667466
auto ctorLocator = cs.getConstraintLocator(
7467-
locator.withPathElement(ConstraintLocator::ApplyFunction)
7468-
.withPathElement(ConstraintLocator::ConstructorMember));
7467+
locator.withPathElement(ConstraintLocator::ApplyFunction)
7468+
.withPathElement(ConstraintLocator::ConstructorMember));
74697469
auto selected = solution.getOverloadChoiceIfAvailable(ctorLocator);
74707470
if (!selected) {
74717471
assert(ty->hasError() || ty->hasUnresolvedType());
@@ -7486,7 +7486,8 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
74867486
/*dotLoc=*/SourceLoc(), choice,
74877487
DeclNameLoc(fn->getEndLoc()),
74887488
selected->openedType, locator, ctorLocator,
7489-
/*Implicit=*/true, choice.getFunctionRefKind(),
7489+
/*Implicit=*/true,
7490+
choice.getFunctionRefKind(),
74907491
AccessSemantics::Ordinary, isDynamic);
74917492
if (!declRef)
74927493
return nullptr;

lib/Sema/CSSimplify.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4529,8 +4529,9 @@ lookupDynamicCallableMethods(Type type, ConstraintSystem &CS,
45294529
auto cand = cast<FuncDecl>(choice.getDecl());
45304530
return !isValidDynamicCallableMethod(cand, decl, CS.TC, hasKeywordArgs);
45314531
};
4532-
candidates.erase(std::remove_if(candidates.begin(), candidates.end(), filter),
4533-
candidates.end());
4532+
candidates.erase(
4533+
std::remove_if(candidates.begin(), candidates.end(), filter),
4534+
candidates.end());
45344535

45354536
llvm::DenseSet<FuncDecl *> methods;
45364537
for (auto candidate : candidates)
@@ -4539,8 +4540,8 @@ lookupDynamicCallableMethods(Type type, ConstraintSystem &CS,
45394540
}
45404541

45414542
/// Looks up and returns the @dynamicCallable required methods (if they exist)
4542-
/// implemented by a type. This function should not be called directly: instead,
4543-
/// call `getDynamicCallableMethods` which performs caching.
4543+
/// implemented by a type. This function should not be called directly:
4544+
/// instead, call `getDynamicCallableMethods` which performs caching.
45444545
static DynamicCallableMethods
45454546
lookupDynamicCallableMethods(Type type, ConstraintSystem &CS,
45464547
const ConstraintLocatorBuilder &locator) {
@@ -4550,13 +4551,14 @@ lookupDynamicCallableMethods(Type type, ConstraintSystem &CS,
45504551
lookupDynamicCallableMethods(type, CS, locator, ctx.Id_withArguments,
45514552
/*hasKeywordArgs*/ false);
45524553
methods.keywordArgumentsMethods =
4553-
lookupDynamicCallableMethods(type, CS, locator, ctx.Id_withKeywordArguments,
4554+
lookupDynamicCallableMethods(type, CS, locator,
4555+
ctx.Id_withKeywordArguments,
45544556
/*hasKeywordArgs*/ true);
45554557
return methods;
45564558
}
45574559

4558-
/// Returns the @dynamicCallable required methods (if they exist) implemented by
4559-
/// a type.
4560+
/// Returns the @dynamicCallable required methods (if they exist) implemented
4561+
/// by a type.
45604562
/// This function may be slow for deep class hierarchies and multiple protocol
45614563
/// conformances, but it is invoked only after other constraint simplification
45624564
/// rules fail.
@@ -4640,10 +4642,10 @@ getDynamicCallableMethods(Type type, ConstraintSystem &CS,
46404642

46414643
ConstraintSystem::SolutionKind
46424644
ConstraintSystem::simplifyDynamicCallableApplicableFnConstraint(
4643-
Type type1,
4644-
Type type2,
4645-
TypeMatchOptions flags,
4646-
ConstraintLocatorBuilder locator) {
4645+
Type type1,
4646+
Type type2,
4647+
TypeMatchOptions flags,
4648+
ConstraintLocatorBuilder locator) {
46474649
auto &ctx = getASTContext();
46484650

46494651
// By construction, the left hand side is a function type: $T1 -> $T2.
@@ -4675,8 +4677,9 @@ ConstraintSystem::simplifyDynamicCallableApplicableFnConstraint(
46754677
if (desugar2->isTypeVariableOrMember())
46764678
return formUnsolved();
46774679

4678-
// If right-hand side is a function type, it must be a valid `dynamicallyCall`
4679-
// method type. Bind the output and convert the argument to the input.
4680+
// If right-hand side is a function type, it must be a valid
4681+
// `dynamicallyCall` method type. Bind the output and convert the argument
4682+
// to the input.
46804683
auto func1 = type1->castTo<FunctionType>();
46814684
if (auto func2 = dyn_cast<FunctionType>(desugar2)) {
46824685
// The argument type must be convertible to the input type.

test/SILGen/dynamic_callable_attribute.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@dynamicCallable
66
public struct Callable {
77
func dynamicallyCall(withArguments: [Int]) {}
8-
func dynamicallyCall(withKeywordArguments: DictionaryLiteral<String, Int>) {}
8+
func dynamicallyCall(withKeywordArguments: KeyValuePairs<String, Int>) {}
99
}
1010

1111
@_silgen_name("foo")

0 commit comments

Comments
 (0)