diff --git a/test/Constraints/member_import_visibility.swift b/test/Constraints/member_import_visibility.swift new file mode 100644 index 0000000000000..cda1c01513a7a --- /dev/null +++ b/test/Constraints/member_import_visibility.swift @@ -0,0 +1,39 @@ +// RUN: %empty-directory(%t) +// RUN: %empty-directory(%t/src) +// RUN: split-file %s %t/src + +/// Build the library A +// RUN: %target-swift-frontend -emit-module %t/src/A.swift \ +// RUN: -module-name A \ +// RUN: -emit-module-path %t/A.swiftmodule + +/// Build the library B +// RUN: %target-swift-frontend -I %t -emit-module %t/src/B.swift \ +// RUN: -module-name B \ +// RUN: -emit-module-path %t/B.swiftmodule + +// RUN: %target-swift-frontend -typecheck -I %t %t/src/Main.swift %t/src/Other.swift -enable-upcoming-feature MemberImportVisibility + +// REQUIRES: swift_feature_MemberImportVisibility + +//--- A.swift +public struct Test { + public init(a: Double) { } +} + +//--- B.swift +import A + +extension Test { + public init(a: Int) { fatalError() } +} + +//--- Main.swift +import A + +func test() { + _ = Test(a: 0) // Ok, selects the overload that takes Double. +} + +//--- Other.swift +import B diff --git a/validation-test/Sema/rdar143582881.swift b/validation-test/Sema/rdar143582881.swift new file mode 100644 index 0000000000000..1d032cc762608 --- /dev/null +++ b/validation-test/Sema/rdar143582881.swift @@ -0,0 +1,16 @@ +// RUN: %empty-directory(%t) +// RUN: split-file %s %t + +// RUN: %target-swift-frontend -typecheck %t/Main.swift %t/Other.swift -enable-upcoming-feature MemberImportVisibility + +//--- Main.swift + +import Foundation + +func test() -> CGSize { + return CGSize(width: 60, height: 45) +} + +//--- Other.swift + +import CoreGraphics