Skip to content

Commit c409f39

Browse files
committed
---
yaml --- r: 323579 b: refs/heads/tensorflow-next c: 7cacdeb h: refs/heads/master i: 323577: 9b870a3 323575: e690598
1 parent c14f0c3 commit c409f39

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,4 +1461,4 @@ refs/heads/master-rebranch: 86e95c23aa0d37f24ec138b7853146c1cead2e40
14611461
refs/heads/rdar-53901732: 9bd06af3284e18a109cdbf9aa59d833b24eeca7b
14621462
refs/heads/revert-26776-subst-always-returns-a-type: 1b8e18fdd391903a348970a4c848995d4cdd789c
14631463
refs/heads/tensorflow-merge: 8b854f62f80d4476cb383d43c4aac2001dde3cec
1464-
refs/heads/tensorflow-next: 4b630df071c1baf3a29f2a1021e3192aff7cff6f
1464+
refs/heads/tensorflow-next: 7cacdebf6c4c9d2c98c6befd0cd69a88e38b15b9

branches/tensorflow-next/lib/IDE/ExprContextAnalysis.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,15 @@ class ExprContextAnalyzer {
583583
case ExprKind::Array: {
584584
if (auto type = ParsedExpr->getType()) {
585585
recordPossibleType(type);
586+
break;
587+
}
588+
589+
// Check context types of the array literal expression.
590+
ExprContextInfo arrayCtxtInfo(DC, Parent);
591+
for (auto arrayT : arrayCtxtInfo.getPossibleTypes()) {
592+
if (auto boundGenericT = arrayT->getAs<BoundGenericType>())
593+
if (boundGenericT->getDecl() == Context.getArrayDecl())
594+
recordPossibleType(boundGenericT->getGenericArgs()[0]);
586595
}
587596
break;
588597
}

branches/tensorflow-next/test/IDE/complete_call_arg.swift

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@
8282
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_MEMBER_AFTERPAREN_2 | %FileCheck %s -check-prefix=IMPLICIT_MEMBER_AFTERPAREN_2
8383
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_MEMBER_SECOND | %FileCheck %s -check-prefix=IMPLICIT_MEMBER_SECOND
8484
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_MEMBER_SKIPPED | %FileCheck %s -check-prefix=IMPLICIT_MEMBER_SKIPPED
85+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_MEMBER_ARRAY_1_AFTERPAREN_1 | %FileCheck %s -check-prefix=IMPLICIT_MEMBER_AFTERPAREN_1
86+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_MEMBER_ARRAY_1_AFTERPAREN_2 | %FileCheck %s -check-prefix=IMPLICIT_MEMBER_AFTERPAREN_2
87+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_MEMBER_ARRAY_1_SECOND | %FileCheck %s -check-prefix=IMPLICIT_MEMBER_SECOND
88+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_MEMBER_ARRAY_1_SKIPPED | %FileCheck %s -check-prefix=IMPLICIT_MEMBER_SKIPPED
89+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_MEMBER_ARRAY_2_AFTERPAREN_1 | %FileCheck %s -check-prefix=IMPLICIT_MEMBER_AFTERPAREN_1
90+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_MEMBER_ARRAY_2_AFTERPAREN_2 | %FileCheck %s -check-prefix=IMPLICIT_MEMBER_AFTERPAREN_2
91+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_MEMBER_ARRAY_2_SECOND | %FileCheck %s -check-prefix=IMPLICIT_MEMBER_SECOND
92+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=IMPLICIT_MEMBER_ARRAY_2_SKIPPED | %FileCheck %s -check-prefix=IMPLICIT_MEMBER_SKIPPED
8593

8694
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=ARCHETYPE_GENERIC_1 | %FileCheck %s -check-prefix=ARCHETYPE_GENERIC_1
8795

@@ -688,6 +696,39 @@ func testImplicitMember() {
688696
// IMPLICIT_MEMBER_SKIPPED: Keyword/ExprSpecific: arg4: [#Argument name#];
689697
// IMPLICIT_MEMBER_SKIPPED: End completions
690698
}
699+
func testImplicitMemberInArrayLiteral() {
700+
struct Receiver {
701+
init(_: [TestStaticMemberCall]) {}
702+
init(arg1: Int, arg2: [TestStaticMemberCall]) {}
703+
}
704+
705+
Receiver([
706+
.create1(x: 1),
707+
.create1(#^IMPLICIT_MEMBER_ARRAY_1_AFTERPAREN_1^#),
708+
// Same as IMPLICIT_MEMBER_AFTERPAREN_1.
709+
])
710+
Receiver([
711+
.create2(#^IMPLICIT_MEMBER_ARRAY_1_AFTERPAREN_2^#),
712+
// Same as IMPLICIT_MEMBER_AFTERPAREN_2.
713+
.create2(1, #^IMPLICIT_MEMBER_ARRAY_1_SECOND^#
714+
// Same as IMPLICIT_MEMBER_SECOND.
715+
])
716+
Receiver(arg1: 12, arg2: [
717+
.create2(1, arg3: 2, #^IMPLICIT_MEMBER_ARRAY_1_SKIPPED^#
718+
// Same as IMPLICIT_MEMBER_SKIPPED.
719+
.create1(x: 12)
720+
])
721+
let _: [TestStaticMemberCall] = [
722+
.create1(#^IMPLICIT_MEMBER_ARRAY_2_AFTERPAREN_1^#),
723+
// Same as STATIC_METHOD_AFTERPAREN_1.
724+
.create2(#^IMPLICIT_MEMBER_ARRAY_2_AFTERPAREN_2^#),
725+
// Same as STATIC_METHOD_AFTERPAREN_2.
726+
.create2(1, #^IMPLICIT_MEMBER_ARRAY_2_SECOND^#),
727+
// Same as STATIC_METHOD_SECOND.
728+
.create2(1, arg3: 2, #^IMPLICIT_MEMBER_ARRAY_2_SKIPPED^#),
729+
// Same as STATIC_METHOD_SKIPPED.
730+
]
731+
}
691732

692733
struct Wrap<T> {
693734
func method<U>(_ fn: (T) -> U) -> Wrap<U> {}

0 commit comments

Comments
 (0)