File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3
- refs/heads/master-next: b025c3099de503660c74e8d9a19613f84564ee37
3
+ refs/heads/master-next: 13e65c966a185b166f31353b5649f5001e1ee433
4
4
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
5
5
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
6
6
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07
Original file line number Diff line number Diff line change @@ -1279,11 +1279,23 @@ class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks {
1279
1279
if (CheckKind == CompletionTypeCheckKind::Normal &&
1280
1280
ParsedExpr->getType () && !ParsedExpr->getType ()->is <ErrorType>()) {
1281
1281
auto refDecl = ParsedExpr->getReferencedDecl ();
1282
+ auto exprTy = ParsedExpr->getType ();
1282
1283
if (!refDecl) {
1283
- if (auto apply = dyn_cast<ApplyExpr>(ParsedExpr))
1284
+ // FIXME: do this in the not-already-type-checked branch too?
1285
+ if (auto *apply = dyn_cast<SelfApplyExpr>(ParsedExpr)) {
1284
1286
refDecl = apply->getFn ()->getReferencedDecl ();
1287
+ } else if (auto *apply = dyn_cast<ApplyExpr>(ParsedExpr)) {
1288
+ // If this is an IUO, use the underlying non-optional type instead
1289
+ auto fnDecl = apply->getFn ()->getReferencedDecl ();
1290
+ if (auto FD = fnDecl.getDecl ()) {
1291
+ if (FD->isImplicitlyUnwrappedOptional ()) {
1292
+ if (auto OT = exprTy->getOptionalObjectType ())
1293
+ exprTy = OT;
1294
+ }
1295
+ }
1296
+ }
1285
1297
}
1286
- return std::make_pair (ParsedExpr-> getType () , refDecl);
1298
+ return std::make_pair (exprTy , refDecl);
1287
1299
}
1288
1300
1289
1301
ConcreteDeclRef ReferencedDecl = nullptr ;
Original file line number Diff line number Diff line change 199
199
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_ARRAY_LITERAL_2 | %FileCheck %s -check-prefix=SIMPLE_OBJECT_DOT
200
200
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_DICTIONARY_LITERAL_1 | %FileCheck %s -check-prefix=SIMPLE_OBJECT_DOT
201
201
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IN_DICTIONARY_LITERAL_2 | %FileCheck %s -check-prefix=SIMPLE_OBJECT_DOT
202
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE_CALL_RESULT | %FileCheck %s -check-prefix=COMPLETE_CALL_RESULT
202
203
203
204
// Test code completion of expressions that produce a value.
204
205
@@ -2173,3 +2174,17 @@ func testInCollectionLiteral(value: SimpleStruct) {
2173
2174
value. #^IN_DICTIONARY_LITERAL_2^# : " test "
2174
2175
]
2175
2176
}
2177
+
2178
+ // rdar://problem/54047322
2179
+ struct Resolver < T> {
2180
+ func fulfill( _ value: T ) { }
2181
+ }
2182
+ func wrapSuccess< T> ( _ onSuccess: @escaping ( T ) -> Void ) -> ( T , Bool ) -> Void {
2183
+ fatalError ( )
2184
+ }
2185
+ func testWrapSuccess( promise: Int , seal: Resolver < Void > ) {
2186
+ wrapSuccess ( seal. fulfill) #^COMPLETE_CALL_RESULT^#
2187
+ // COMPLETE_CALL_RESULT: Begin completions
2188
+ // COMPLETE_CALL_RESULT: Pattern/CurrModule: ({#Void#}, {#Bool#})[#Void#]; name=(Void, Bool)
2189
+ // COMPLETE_CALL_RESULT: End completions
2190
+ }
You can’t perform that action at this time.
0 commit comments