Commit Graph

12570 Commits

Author SHA1 Message Date
Joe Groff
cf6cc484c0 Switch on key paths.
Enabling the global subscript degrades some diagnostics (rdar://problem/31724211).
2017-05-05 08:32:41 -07:00
swift-ci
476d84e313 Merge pull request #9286 from DougGregor/swift-3-anyobject-compat 2017-05-04 11:05:13 -07:00
Doug Gregor
ef7b8039ec [Type checker] Warn about classes conforming to AnyObject in Swift 3 mode.
Swift 3 allowed a class to explicitly conform to AnyObject, although
it was meaningless. Recent AnyObject-related changes started rejecting
such conformances as ill-formed; allow them with a warning + Fix-It in
Swift 3 compatibility mode.
2017-05-04 10:28:27 -07:00
Doug Gregor
6c8dd3959f [AST] Dodge an annoying libc++ std::function quirk requiring complete result types 2017-05-04 08:51:47 -07:00
swift-ci
f146e16de0 Merge pull request #9278 from practicalswift/gardening-20170504 2017-05-04 07:20:42 -07:00
Doug Gregor
fea9aded6c Merge pull request #9279 from DougGregor/remove-substoptions-ctor
[AST] Remove unused SubstOptions constructor.
2017-05-04 07:06:11 -07:00
Doug Gregor
4db0a4a070 [AST] Remove unused SubstOptions constructor.
On some implementations of the C++ Standard Library, trying to
move-construct an std::function will require that the return type be
complete. SubstOptions' GetTentativeTypeWitness function returns Type,
which is defined later in this file, which can trigger the failure.
2017-05-04 07:02:52 -07:00
practicalswift
f7a16f5149 [gardening] Remove unused diagnostic 2017-05-04 15:22:07 +02:00
swift-ci
8610e7a096 Merge pull request #9275 from DougGregor/type-witness-inference-validation 2017-05-04 01:29:52 -07:00
Ted Kremenek
35f10a5ecd Merge pull request #9266 from jckarter/serialize-key-path
SIL: Serialization for KeyPathInsts.
2017-05-03 23:02:05 -07:00
Doug Gregor
dbb973aab4 [AST] Allow tentative type witnesses to be plumbed through SubstOptions.
Extend SubstOptions, which controls how substitution is performed, to
allow the caller to subst() to provide a callback function that may
provide a type witness for a normal protocol conformance that is
undergoing type witness inference. In effect, it's allowing us to
provide tentative bindings for type witnesses so we can see the
effects of substitution.
2017-05-03 22:38:53 -07:00
Joe Groff
7bb2064061 Merge pull request #9263 from jckarter/keypath-inst-effects
SIL: KeyPathInst has to have side effects, since it retains.
2017-05-03 20:24:44 -07:00
Joe Groff
70f15b3c5e SIL: Serialization for KeyPathInsts.
rdar://problem/31768491
2017-05-03 20:22:39 -07:00
Joe Groff
76b9f21f59 SIL: KeyPathInst has to have side effects, since it retains.
Fixes rdar://problem/31975279.
2017-05-03 19:25:27 -07:00
Xi Ge
beb5347f95 [Migrator] During de-serialization, remove duplicated API diff items from the store. (#9239) 2017-05-03 16:48:44 -07:00
Jordan Rose
c8d3506e55 Revert "[Mangling] Uniformly use "So" for imported decls." (#9233)
This reverts commit 25985cb764. For now,
we're trying to avoid spurious non-structural changes to the mangling,
so that the /old/ mangling doesn't appear to change. That doesn't mean
no changes at all, but we can save this one for later.
2017-05-03 16:13:29 -07:00
Erik Eckstein
285addb92d Switch back to the old mangling for ObjC runtime names.
To be backward compatible to existing archives created by the NSKeyedArchiver
2017-05-03 10:52:54 -07:00
Doug Gregor
66f38da9a3 Merge pull request #9206 from DougGregor/NSKeyedArchiveLegacy
Warn about NSCoding classes with unstable mangled names
2017-05-03 08:20:23 -07:00
Doug Gregor
bf7a8612e6 Add @NSKeyedArchiveSubclassesOnly to suppress NSCoding unstable name diags.
Introduce the @NSKeyedArchiveSubclassesOnly attribute, which can be
placed on a class that conforms to NSCoding to suppress the
unstable-name diagnostics by promising to only archive
subclasses---not this class directly.
2017-05-02 23:30:28 -07:00
Doug Gregor
9b65c85b44 Make diagnostics for NSCoding classes with unstable names more discouraging.
The diagnostic regarding NSCoding classes with unstable names can be
suppressed by adding @objc (the preferred solution for new code) or
@NSKeyedArchiveLegacy (for existing archives). Provide those as
Fix-Its, in that order.

(Thanks, Jordan!)
2017-05-02 23:30:28 -07:00
Doug Gregor
e6c6470f1e Properly warn about local classes that conform to NSCoding. 2017-05-02 23:30:28 -07:00
Doug Gregor
bafa99cd6e Add the @_staticInitializeObjCMetadata attribute.
Currently inactive, this attribute indicates that a static initializer should be emitted to register the Objective-C metadata when the image is loaded, rather than on first use of the Objective-C metadata. Infer this attribute for NSCoding classes that won’t have static Objective-C metadata or have an @NSKeyedArchiveLegacy attributed.
2017-05-02 23:30:27 -07:00
David Farler
e92ad3bb96 Merge pull request #9197 from bitjammer/rdar-31926195-migrator-everyone-deserves-a-second-chance
[Migrator] Make performing a fix-it run return the instance used
2017-05-02 23:19:59 -07:00
Doug Gregor
b912c7f7e1 Diagnose attempts to apply @NSKeyedArchiveLegacy to a generic class.
Generic classes don't have a single name to register, so disallow
@NSKeyedArchiveLegacy.
2017-05-02 22:38:32 -07:00
Doug Gregor
60f5a6529e Add Fix-Its suggesting @NSKeyedArchiveLegacy when it can be used. 2017-05-02 22:38:32 -07:00
Doug Gregor
aaf7933a6d Add the @NSKeyedArchiveLegacy attribute.
This attribute allows one to provide the "legacy" name of a class for
the purposes of archival (via NSCoding). At the moment, it is only
useful for suppressing the warnings/errors about classes with unstable
archiving names.
2017-05-02 22:38:32 -07:00
Slava Pestov
e8f4930cb5 Merge pull request #9192 from slavapestov/anyobject-removal-vol-4
AnyObject removal volume 4
2017-05-02 22:03:44 -07:00
Doug Gregor
28560ec005 [Type checker] Warn about NSCoding-conforming classes with unstable mangled names.
The name mangling changed from Swift 3 to Swift 4, and may get slight
tweaks as we lock down ABI stability. Identify and warn about (in
Swift 3) or error about (in Swift 4) the cases where we don't have
obviously-stable name mangling, e.g.,

* private/fileprivate classes (whose mangled names involve the file name)
* nested classes (whose mangled names depend on their enclosing type)
* generic classes (whose mangled names involve the type arguments)
2017-05-02 21:45:18 -07:00
David Farler
a2f48ff8c2 [Migrator] Make performing a fix-it run return the instance used
This CompilerInstance will be used if a fix-it run created an
error-free AST that we can continue to use in the AST passes.

rdar://problem/31926195
2017-05-02 21:37:17 -07:00
Xi Ge
57fa43c9af [RangeInfo] Avoid analyzing implicit ASTNodes. rdar://31773556 (#9210) 2017-05-02 21:19:46 -07:00
Joe Groff
7913e9821b Merge pull request #9214 from jckarter/keypaths-32-bit
Support key paths on 32-bit platforms.
2017-05-02 20:36:07 -07:00
Slava Pestov
b5721e8d8e AST: Remove AnyObject protocol 2017-05-02 19:45:00 -07:00
Joe Groff
525001f7a7 Support key paths on 32-bit platforms.
I had optimistically written the code here optimistically hoping #7837 would land in time for me to merge, but that didn't happen, so adjust some things to match the current 12-byte object header size on 32-bit, and introduce some ABI constants for the expected 32- and 64-bit object header sizes we can assert against so that we have some robustness when it eventually changes again. Implements rdar://problem/31768303.
2017-05-02 18:19:07 -07:00
Robert Widmann
155273a968 Merge pull request #9199 from nkcsgexi/separate-note-switch
Sema: Move the fixit for adding missing enum cases to a separate note instead of attaching to the exhaustive error itself.
2017-05-02 20:36:36 -04:00
Joe Groff
fa4e4bea18 Merge pull request #9204 from jckarter/opened-type-subst
SILCloner: Map opened types using Type::subst instead of transform.
2017-05-02 16:51:30 -07:00
ematejska
75a1dcaf28 Merge pull request #9098 from KingOfBrian/feature/SE-0169
SE-0169: Add support for shared private
2017-05-02 16:12:17 -07:00
Joe Groff
6764072773 SILCloner: Map opened types using Type::subst instead of transform.
transform doesn't handle conformances properly, so it blows up on SILBoxTypes (and would eventually blow up on BoundGenericTypes if we ever model their arguments properly as substitution lists). Fixes rdar://problem/31941811.
2017-05-02 15:38:12 -07:00
Xi Ge
99094782a3 whitelist missing enum cases fixits. 2017-05-02 15:04:24 -07:00
Xi Ge
6b31126a9f Merge branch 'master' into separate-note-switch 2017-05-02 14:00:26 -07:00
Huon Wilson
4fc27a1f3e Merge pull request #9150 from huonw/keypath-syntax
Implement \ syntax for Swift key paths.
2017-05-03 06:22:47 +10:00
Xi Ge
1acbf56d7b Sema: Move the fixit for adding missing enum cases to a separate note instead of attaching to the exhaustive error itself. 2017-05-02 12:13:18 -07:00
Xi Ge
39c550fc40 [Migrator] Handle function decl renames. rdar://31766131 (#9157) 2017-05-02 10:53:56 -07:00
Joe Groff
e2fdea9709 Merge pull request #9174 from jckarter/keypath-dfe
SIL: Don't DFE functions referenced from KeyPath patterns.
2017-05-02 07:57:50 -07:00
Slava Pestov
f3761c1c2e Reflection: Update for subclass existentials and primitive AnyObject 2017-05-02 02:23:08 -07:00
Slava Pestov
5ac0925889 ABI: Give ExistentialTypeFlags a public constructor 2017-05-02 02:23:07 -07:00
Slava Pestov
a77f2f2045 Reflection: Share a Demangler instead of creating new ones all the time 2017-05-02 01:19:36 -07:00
Slava Pestov
ab4d37a422 Reflection: Record superclass as its own field instead of an associated type of AnyObject
The "superclass as associated type" modeling was put in to
maintain backward compatibility.

We just bumped the version number because of new mangling so
we may as well fix this sillyness too.
2017-05-02 01:18:49 -07:00
Slava Pestov
ea4fe32295 Reflection: Give up instead of producing an empty field list if a field type does not demangle
Better to fail instead of producing an invalid layout.
2017-05-02 01:18:24 -07:00
swift-ci
707cecb93a Merge pull request #9182 from atrick/access 2017-05-02 00:04:21 -07:00
Doug Gregor
6d241509e6 Merge pull request #9168 from DougGregor/se-0160-disable-warnings-by-default
[SE-0160] Make deprecated @objc inference warnings opt-in.
2017-05-01 22:12:53 -07:00