Commit Graph

21 Commits

Author SHA1 Message Date
Nathan Hawes
280d4c995a Merge remote-tracking branch 'upstream/master' into HEAD 2020-08-21 22:23:58 -07:00
Brent Royal-Gordon
9d4281b46b Support generic @compatibility_alias in PrintAsObjC
When @compatibility_alias is used with an ObjC generic class, this ends up importing as a generic typealias. PrintAsObjC previously didn’t handle declarations involving these types correctly; it would fail an assertion in asserts compilers, and potentially print an incorrect compatibility header in non-asserts compilers.

This PR makes it so that PrintAsObjC can now correctly use generic typealiases imported from Objective-C modules. It is, of course, still not possible to declare a generic typealias in Swift that will be printed into the Objective-C header.

Fixes rdar://67256866.
2020-08-20 16:21:50 -07:00
swift_jenkins
10d7479b62 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-20 15:35:35 -07:00
Brent Royal-Gordon
a60aad89a7 [PrintAsObjC] Forward-declare bridged types
The initial pass through a type’s members to forward-declare or import anything needed by them did not account for _ObjectiveCBridgeable conformances; instead, it would examine the Swift type being bridged from, either tripping an assertion or just failing to do anything. Treat these as references to the bridged type instead.

Fixes rdar://67263753.
2020-08-19 13:53:06 -07:00
Brent Royal-Gordon
a90d63df49 [NFC] Add PrettyStackTraces to ObjC forward decls
Helps identify the cause of some crashes.
2020-08-19 13:53:05 -07:00
Karoy Lorentey
68351d2110 Revert "Merge remote-tracking branch 'origin/master-next'"
This reverts commit 1c9b0908e6, reversing
changes made to 3eb82c1836.
2020-06-08 16:48:38 -07:00
swift_jenkins
f17041933f Merge remote-tracking branch 'origin/master' into master-next 2020-05-21 18:38:49 -07:00
Slava Pestov
14cc7dd9bd PrintAsObjC: Fix crash when printing typedef that was imported inside an Objective-C generic class
The assertion here is too strict. The TypeAliasDecl will inherit a
generic signature from the outer context even if it does not have
generic parameters of its own. Instead, let's just assert that the
TypeAliasDecl does not have its own generic parameters.

Fixes <rdar://problem/63188938>.
2020-05-21 17:35:49 -04:00
Erik Eckstein
bdd337cd17 Merge remote-tracking branch 'origin/master' into master-next 2020-05-15 20:13:50 +02:00
Anthony Latsis
44a92a926c [NFC] GenericSignatureImpl: Spell conformsToProtocol & getConformsTo in terms of requirements 2020-05-14 22:51:44 +03:00
swift_jenkins
69248bf426 Merge remote-tracking branch 'origin/master' into master-next 2020-04-21 14:17:19 -07:00
Alexis Laferrière
fa5924407d [PrintAsObjC] Don't include the module for empty extensions
rdar://problem/57133517
2020-04-20 16:36:59 -07:00
swift_jenkins
991f679164 Merge remote-tracking branch 'origin/master' into master-next 2020-04-13 21:21:23 -07:00
Doug Gregor
72ade27956 Revert "[PrintAsObjC] Don't include the module for empty extensions"
This reverts commit 8f01b2c8f8.
2020-04-10 00:08:46 -07:00
swift_jenkins
14a14a232b Merge remote-tracking branch 'origin/master' into master-next 2020-04-01 09:00:36 -07:00
Anthony Latsis
d0ae3ee580 [AST] Replace FuncDecl::getName & EnumElementDecl::getName with ValueDecl::getBaseIdentifier 2020-03-29 00:35:51 +03:00
Adrian Prantl
1bd6a0a371 Adapt to upstream header file reshuffling in c915cb957dc37275ce1ca1a0b993239c82f12692. 2020-03-11 15:46:37 -07:00
Alexis Laferrière
8f01b2c8f8 [PrintAsObjC] Don't include the module for empty extensions
rdar://problem/57133517
2020-03-09 14:10:44 -07:00
Robert Widmann
5a8d0744c3 [NFC] Adopt TypeBase-isms for GenericSignature
Structurally prevent a number of common anti-patterns involving generic
signatures by separating the interface into GenericSignature and the
implementation into GenericSignatureBase.  In particular, this allows
the comparison operators to be deleted which forces callers to
canonicalize the signature or ask to compare pointers explicitly.
2019-09-30 14:04:36 -07:00
Jordan Rose
a3063ccfc0 [PrintAsObjC] Use TypeDeclFinder instead of custom TypeVisitor (#27189)
This is the same type-walking logic we use for access control
checking, so it had better be correct. Perfect case for DRY!

No functionality change.
2019-09-14 15:20:47 -07:00
Jordan Rose
83e7763e9f [PrintAsObjC] Separate out module contents printing too (#27184)
The top-level PrintAsObjC now just covers import printing and the
near-literal prologue/epilogue text, while the decl printing (and
import collecting) is in its own file. No functionality change.
2019-09-13 20:13:59 -07:00