File tree Expand file tree Collapse file tree 2 files changed +22
-9
lines changed Expand file tree Collapse file tree 2 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -1955,17 +1955,13 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
1955
1955
// lookups is IUO, not Optional as it is for the @optional attribute.
1956
1956
if (dynamicOrOptional) {
1957
1957
T = T->getOptionalObjectType ();
1958
- suffix = " !?" ;
1959
- } else {
1960
- suffix = " !" ;
1958
+ suffix = " ?" ;
1961
1959
}
1962
1960
1963
- Type ObjectType = T->getReferenceStorageReferent ()->getOptionalObjectType ();
1964
-
1965
- if (ObjectType->isVoid ())
1966
- Builder.addTypeAnnotation (" Void" + suffix);
1967
- else
1968
- Builder.addTypeAnnotation (ObjectType.getStringAsComponent () + suffix);
1961
+ T = T->getReferenceStorageReferent ();
1962
+ PrintOptions PO;
1963
+ PO.PrintOptionalAsImplicitlyUnwrapped = true ;
1964
+ Builder.addTypeAnnotation (T.getString (PO) + suffix);
1969
1965
}
1970
1966
1971
1967
// / For printing in code completion results, replace archetypes with
Original file line number Diff line number Diff line change @@ -296,3 +296,20 @@ func test_28188259(x: ((Int) -> Void) -> Void) {
296
296
// RDAR_28188259-DAG: Pattern/CurrModule: ({#_#})[#Void#]; name=(_)
297
297
// RDAR_28188259-DAG: Keyword[self]/CurrNominal: .self[#(_) -> ()#]; name=self
298
298
// RDAR_28188259: End completions
299
+
300
+ // rdar://problem/40956846
301
+ // RUN: %target-swift-ide-test -code-completion -code-completion-token=RDAR_40956846 -source-filename=%s | %FileCheck %s -check-prefix=RDAR_40956846
302
+ func test_40956846(
303
+ arg_40956846_1: inout Int ! ,
304
+ arg_40956846_2: Void ! ,
305
+ arg_40956846_3: ( ( ) -> Int ) ! ,
306
+ arg_40956846_4: inout ( ( Int ) -> Int ) !
307
+ ) {
308
+ let y = #^RDAR_40956846 ^#
309
+ }
310
+ // RDAR_40956846: Begin completions
311
+ // RDAR_40956846-DAG: Decl[LocalVar]/Local: arg_40956846_1[#inout Int!#]; name=arg_40956846_1
312
+ // RDAR_40956846-DAG: Decl[LocalVar]/Local: arg_40956846_2[#Void!#]; name=arg_40956846_2
313
+ // RDAR_40956846-DAG: Decl[LocalVar]/Local: arg_40956846_3[#(() -> Int)!#]; name=arg_40956846_3
314
+ // RDAR_40956846-DAG: Decl[LocalVar]/Local: arg_40956846_4[#inout ((Int) -> Int)!#]; name=arg_40956846_4
315
+ // RDAR_40956846: End completions
You can’t perform that action at this time.
0 commit comments