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