1212//// The client app should build OK without the private module. Removing the
1313//// private module is superfluous but makes sure that it's not somehow loaded.
1414// RUN: rm %t/private_lib.swiftmodule
15- // RUN: %target-swift-frontend -typecheck -DCLIENT_APP -primary-file %s -I %t -index-system-modules -index-store-path %t
16- // RUN: %target-swift-frontend -emit-sil -DCLIENT_APP -primary-file %s -I %t -module-name client
15+ // RUN: %target-swift-frontend -typecheck -DCLIENT_APP %s -I %t -index-system-modules -index-store-path %t
16+ // RUN: %target-swift-frontend -typecheck -DCLIENT_APP %s -I %t -D FAIL_TYPECHECK -verify
17+ // RUN: %target-swift-frontend -emit-sil -DCLIENT_APP %s -I %t -module-name client
1718
1819//// Printing the public module should not crash when checking for overrides of
1920//// methods from the private module.
@@ -46,6 +47,8 @@ public protocol HiddenProtocolWithOverride {
4647 func hiddenOverride( )
4748}
4849
50+ public class HiddenClass { }
51+
4952#elseif PUBLIC_LIB
5053
5154@_implementationOnly import private_lib
@@ -91,6 +94,10 @@ public struct PublicStructConformsToHiddenProtocol: RefinesHiddenProtocol {
9194 public init ( ) { }
9295}
9396
97+ public class SomeClass {
98+ func funcUsingIoiType( _ a: HiddenClass ) { }
99+ }
100+
94101#elseif CLIENT_APP
95102
96103import public_lib
@@ -101,4 +108,12 @@ print(s.nonWrappedVar)
101108var p = PublicStructConformsToHiddenProtocol ( )
102109print ( p)
103110
111+ #if FAIL_TYPECHECK
112+ // Access to a missing member on an AnyObject triggers a typo correction
113+ // that looks at *all* class members. rdar://79427805
114+ class ClassUnrelatedToSomeClass { }
115+ var something = ClassUnrelatedToSomeClass ( ) as AnyObject
116+ something. triggerTypoCorrection = 123 // expected-error {{value of type 'AnyObject' has no member 'triggerTypoCorrection'}}
117+ #endif
118+
104119#endif
0 commit comments