Skip to content

Commit 197e218

Browse files
committed
---
yaml --- r: 318783 b: refs/heads/master-rebranch c: 432ef94 h: refs/heads/master i: 318781: 7bc3e63 318779: 6c8ea7d 318775: b07ea9e 318767: 5958412 318751: d8c9d40 318719: 2b551c2
1 parent 246e0a5 commit 197e218

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,4 +1457,4 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-02-a: ddd2b2976aa9bfde5f20fe37f6bd2
14571457
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-08-03-a: 171cc166f2abeb5ca2a4003700a8a78a108bd300
14581458
refs/heads/benlangmuir-patch-1: baaebaf39d52f3bf36710d4fe40cf212e996b212
14591459
refs/heads/i-do-redeclare: 8c4e6d5de5c1e3f0a2cedccf319df713ea22c48e
1460-
refs/heads/master-rebranch: 3ba39508ba84ba18f58fced24a906a28f4e9b897
1460+
refs/heads/master-rebranch: 432ef94bf8da2d8922305cfe8bc91e90a2d05350

branches/master-rebranch/lib/Sema/LookupVisibleDecls.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,10 @@ class OverrideFilteringConsumer : public VisibleDeclConsumer {
794794
OtherSignature, OtherSignatureType,
795795
/*wouldConflictInSwift5*/nullptr,
796796
/*skipProtocolExtensionCheck*/true)) {
797-
if (VD->getFormalAccess() > OtherVD->getFormalAccess()) {
797+
if (VD->getFormalAccess() > OtherVD->getFormalAccess() ||
798+
//Prefer available one.
799+
(!AvailableAttr::isUnavailable(VD) &&
800+
AvailableAttr::isUnavailable(OtherVD))) {
798801
PossiblyConflicting.erase(I);
799802
PossiblyConflicting.insert(VD);
800803

branches/master-rebranch/test/IDE/complete_constructor.swift

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_INIT_3 | %FileCheck %s -check-prefix=CLOSURE_IN_INIT_1
4848
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=CLOSURE_IN_INIT_4 | %FileCheck %s -check-prefix=CLOSURE_IN_INIT_1
4949

50+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAILABLE_1 | %FileCheck %s -check-prefix=AVAILABLE_1
51+
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=AVAILABLE_2 | %FileCheck %s -check-prefix=AVAILABLE_2
52+
5053
func freeFunc() {}
5154

5255
//===---
@@ -332,3 +335,33 @@ struct ClosureInInit1 {
332335
S(#^CLOSURE_IN_INIT_4^#
333336
}()
334337
}
338+
339+
public class AvailableTest {
340+
341+
@available(swift, obsoleted: 4)
342+
init(opt: Int) { }
343+
344+
@available(swift, introduced: 4)
345+
init?(opt: Int) { }
346+
347+
init(normal1: Int) { }
348+
init(normal2: Int) { }
349+
350+
351+
}
352+
func testAvailable() {
353+
let _ = AvailableTest(#^AVAILABLE_1^#
354+
// AVAILABLE_1: Begin completions, 3 items
355+
// AVAILABLE_1-DAG: Decl[Constructor]/CurrNominal: ['(']{#opt: Int#}[')'][#AvailableTest?#]; name=opt: Int
356+
// AVAILABLE_1-DAG: Decl[Constructor]/CurrNominal: ['(']{#normal1: Int#}[')'][#AvailableTest#]; name=normal1: Int
357+
// AVAILABLE_1-DAG: Decl[Constructor]/CurrNominal: ['(']{#normal2: Int#}[')'][#AvailableTest#]; name=normal2: Int
358+
// AVAILABLE_1: End completions
359+
360+
let _ = AvailableTest.init(#^AVAILABLE_2^#
361+
// AVAILABLE_2: Begin completions, 3 items
362+
// AVAILABLE_2-DAG: Pattern/CurrModule: ['(']{#opt: Int#}[')'][#AvailableTest?#]; name=opt: Int
363+
// AVAILABLE_2-DAG: Pattern/CurrModule: ['(']{#normal1: Int#}[')'][#AvailableTest#]; name=normal1: Int
364+
// AVAILABLE_2-DAG: Pattern/CurrModule: ['(']{#normal2: Int#}[')'][#AvailableTest#]; name=normal2: Int
365+
// AVAILABLE_2: End completions
366+
367+
}

0 commit comments

Comments
 (0)