Merge pull request #40994 from compnerd/undeserialized

AST,Sema: track and emit un-deserialized members
This commit is contained in:
Saleem Abdulrasool
2022-01-26 08:00:46 -08:00
committed by GitHub
6 changed files with 55 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
#ifndef CLibrary_h
#define CLibrary_h
typedef struct __attribute__((__objc_bridge__(Object))) CObject *CObjectRef;
#endif

View File

@@ -0,0 +1,4 @@
module CLibrary {
header "CLibrary.h"
}

View File

@@ -87,7 +87,19 @@ public class UserDynamicConvenienceSub: UserDynamicConvenience {
}
_ = UserDynamicConvenienceSub(conveniently: 0)
public class UserSub : User {} // expected-error {{cannot inherit from class 'User' because it has overridable members that could not be loaded}}
public class UserSub : User {}
// expected-error@-1 {{cannot inherit from class 'User' because it has overridable members that could not be loaded}}
// expected-note@-2 {{could not deserialize 'wrappedProp'}}
// expected-note@-3 {{could not deserialize 'returnsWrappedMethod()'}}
// expected-note@-4 {{could not deserialize 'constrainedWrapped'}}
// expected-note@-5 {{could not deserialize 'subscript(_:)'}}
// expected-note@-6 {{could not deserialize 'subscript(_:)'}}
// expected-note@-7 {{could not deserialize 'init(wrapped:)'}}
// expected-note@-8 {{could not deserialize 'init(generic:)'}}
// expected-note@-9 {{could not deserialize 'init(wrappedRequired:)'}}
// expected-note@-10 {{could not deserialize 'init(wrappedRequiredInSub:)'}}
// expected-note@-11 {{could not deserialize 'init(wrappedDynamic:)'}}
// expected-note@-12 {{could not deserialize 'init(wrappedRequiredDynamic:)'}}
#endif // VERIFY

View File

@@ -0,0 +1,25 @@
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/swift)
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/swift/SwiftLibrary.swiftmodule %s -module-name SwiftLibrary -I%S/Inputs
// RUN: %target-typecheck-verify-swift -DCLIENT -c %s -module-name client -I%t/swift
#if CLIENT
import SwiftLibrary
public class MyObject: Object {
// expected-error@-1 {{cannot inherit from class 'Object' because it has overridable members that could not be loaded}}
// expected-note@-2 {{could not deserialize 'raw'}}
// expected-note@-3 {{could not deserialize 'init(object:)'}}
}
#else
@_implementationOnly import CLibrary
open class Object {
internal var storage: AnyObject
internal var raw: CObject { unsafeBitCast(storage, to: CObject.self) }
fileprivate init(object: CObject) {
self.storage = object
}
}
#endif