File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -1708,9 +1708,10 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
1708
1708
Type ContextTy = VD->getDeclContext ()->getDeclaredTypeOfContext ();
1709
1709
if (ContextTy) {
1710
1710
Type MaybeNominalType = ExprType->getRValueInstanceType ();
1711
- if (ContextTy->getAnyNominal () == MaybeNominalType->getAnyNominal () &&
1711
+ if (ContextTy->lookThroughAllAnyOptionalTypes ()->getAnyNominal () ==
1712
+ MaybeNominalType->lookThroughAllAnyOptionalTypes ()->getAnyNominal () &&
1712
1713
!isBoringBoundGenericType (MaybeNominalType)) {
1713
- if (Type T = MaybeNominalType->getTypeOfMember (
1714
+ if (Type T = MaybeNominalType->lookThroughAllAnyOptionalTypes ()-> getTypeOfMember (
1714
1715
CurrDeclContext->getParentModule (), VD, TypeResolver.get ()))
1715
1716
return TransformerPt ? T.transform (TransformerPt->getTransformerFunc ()) :
1716
1717
T;
Original file line number Diff line number Diff line change
1
+ // RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=FOO_OPTIONAL_1 | FileCheck %s -check-prefix=FOO_OPTIONAL_1
2
+
3
+ struct Bar {
4
+ }
5
+
6
+ struct Foo < T> {
7
+ func myFunction( foobar: T ) {
8
+ }
9
+ }
10
+
11
+ // SR-642 Code completion does not instantiate generic arguments of a type wrapped in an optional
12
+ let x : Foo < Bar > ? = Foo < Bar > ( )
13
+ x. #^FOO_OPTIONAL_1^#
14
+ // FOO_OPTIONAL_1: Begin completions, 4 items
15
+ // FOO_OPTIONAL_1-DAG: Decl[InstanceMethod]/CurrNominal/Erase[1]: ?.myFunction({#(foobar): Bar#})[#Void#]; name=myFunction(foobar: Bar)
16
+ // FOO_OPTIONAL_1: End completions
You can’t perform that action at this time.
0 commit comments