Skip to content

Commit 803dbfb

Browse files
committed
[NFC] Add/clarify comments.
1 parent e651ed8 commit 803dbfb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4432,6 +4432,9 @@ ConstraintSystem::simplifyApplicableFnConstraint(
44324432
ConstraintLocatorBuilder outerLocator =
44334433
getConstraintLocator(anchor, parts, locator.getSummaryFlags());
44344434

4435+
// Before stripping optional types, save original type for handling
4436+
// @dynamicCallable applications. This supports the fringe case where
4437+
// `Optional` itself is extended with @dynamicCallable functionality.
44354438
auto origType2 = desugar2;
44364439
unsigned unwrapCount = 0;
44374440
if (shouldAttemptFixes()) {

test/attr/attr_dynamic_callable.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ func testExistential(
201201
c: CallableStruct, d: CallableClass
202202
) -> Int {
203203
// Types that define only the `withKeywordsArguments` method can be called
204-
// with no arguments.
205-
_ = b() + d()
204+
// with no argument labels.
205+
_ = b() + b(1, 2) + d() + d(1, 2)
206206
return a(1, 2, 3) + b(label1: 1, 2, label2: 3) + c(1, 2, 3) + d(label1: 1, 2, 3)
207207
}
208208

@@ -243,7 +243,7 @@ func testRefinedProtocolType<P : FloatingPoint>(
243243
extension Optional : KeywordCallableProtocol {}
244244
extension Array : KeywordCallableProtocol {}
245245

246-
func testOptionalExtension() {
246+
func testExtensions() {
247247
let x: Int? = 3
248248
// Test `Optional` extension.
249249
print(x())

0 commit comments

Comments
 (0)