Commit Graph

23 Commits

Author SHA1 Message Date
Anthony Latsis
934964d49d Use AbstractStorageDecl::isSettableInSwift to prohibit direct writes to optional requirements
Stop pretending that an optional requirement is immutable via the `StorageImplInfo` request.
This approach has lead astray the conformance checker and may have had a negative impact
on other code paths, and it doesn't work for imported declarations because they bypass the
request. Instead, use a forwarding `AbstractStorageDecl::isSettableInSwift` method
that special-cases optional requirements.
2022-04-20 14:27:15 +03:00
Anthony Latsis
4a0f6cedc9 CS: optional storage key path components are read-only 2022-04-14 18:38:29 +03:00
Anthony Latsis
075db56329 SILGen: Handle key paths with @objc optional subscript components 2022-04-01 17:15:32 +03:00
Anthony Latsis
c23b9a49ae SILGen: Handle key paths with @objc optional property components 2022-04-01 17:15:32 +03:00
Yersultan Sapar
e374bc7aa5 Added compatible ObjC string for keypath argument of the dynamic member lookup subscript. 2020-08-14 10:58:34 -07:00
Slava Pestov
9ec80df97e SIL: Remove curried SILDeclRefs 2020-03-19 02:20:21 -04:00
Joe Groff
9c08fccf08 Judge the need for an external key path reference by the overridden base.
We identify overrides using the same key path descriptor as the base, but an overridden base
may not have a property descriptor if it's @objc or fragile. Fixes rdar://problem/51479334.
2019-06-19 16:07:50 -07:00
Arnold Schwaighofer
a389f13ee9 SILGen: Only set the external decl of a key path component if the accessor is public
rdar://49064011
2019-04-02 13:41:55 -07:00
Michael Gottesman
40a09c9c21 Fixup tests for -assume-parsing-unqualified-ownership-sil => [ossa] transition. 2018-12-18 00:49:32 -08:00
Slava Pestov
b570a5de87 Remove -enable-key-path-resilience staging flag 2018-11-16 23:18:37 -05:00
Erik Eckstein
39bb14b094 change mangling prefix from $S to $s
This is the final ABI mangling prefix

rdar://problem/38471478
2018-09-19 13:55:11 -07:00
Joe Groff
1eb1637f6f SILGen: ObjC-dispatched properties don't have external descriptors.
The selector identifies the storage.
2018-07-27 13:15:49 -07:00
Slava Pestov
5e5d59c377 Migrate SILGen tests to Swift 4 2018-06-22 01:55:33 -07:00
Slava Pestov
5d2752f7d2 Run tests with -swift-version 4 by default
Some test now fail, so add an explicit -swift-version 3.
2018-06-19 23:24:19 -07:00
Alex Hoppen
560c22b18e [tests] Verify the libSyntax tree on SILGen tests
The SILGen testsuite consists of valid Swift code covering most language
features. We use these tests to verify that no unknown nodes are in the
file's libSyntax tree. That way we will (hopefully) catch any future
changes or additions to the language which are not implemented in
libSyntax.
2018-04-27 09:33:03 -07:00
Erik Eckstein
cd3d50a5d9 ABI: Change the mangling prefix from _T0 to $S 2018-01-06 13:55:59 -08:00
Joe Groff
f7fc74332c AST: Property requirements in @objc protocols should return true for requiresForeignGetterAndSetter.
We need to use ObjC dispatch to get to the witness of an ObjC protocol requirement. The wrong answer here was causing us to do the wrong thing when producing identifiers for key paths that refer to ObjC protocol requirements.
2017-12-18 12:29:14 -08:00
Joe Groff
2ba8f57514 Remove staging flag for unimplemented key path components.
All the originally-planned component kinds are now implemented.
2017-09-15 11:55:35 -07:00
Joe Groff
2c0873a997 Correct getAccessStrategy for class extension storage decls.
Class extension methods are non-polymorphic unless @objc. Fixes rdar://problem/32434652.
2017-06-01 16:38:03 -07:00
Joe Groff
faa6bc72f0 Sema: Reject unimplemented key path components during resolveKeyPathExpr.
This is a bit more robust and user-friendly than hoping more brittle recovery in SILGen or IRGen for unsupported components kicks in. rdar://problem/32200714
2017-05-15 16:10:59 -07:00
Joe Groff
9830f394c1 SILGen/IRGen/KeyPaths: Components for ObjC properties need to be identified by selector.
A property imported from Objective-C, or marked in Swift with the `dynamic` keyword, doesn't have a vtable slot, so can't be identified that way. Use the ObjC selector as the unique identifier to ascribe equality to such components. Fixes rdar://problem/31768669. (While we're here, throw some more execution tests and a changelog note in.)
2017-05-11 14:28:19 -07:00
Huon Wilson
07c5ab8fb2 Implement \ syntax for Swift key paths.
This introduces a few unfortunate things because the syntax is awkward.
In particular, the period and following token in \.[a], \.? and \.! are
token sequences that don't appear anywhere else in Swift, and so need
special handling. This is somewhat compounded by \foo.bar.baz possibly
being \(foo).bar.baz or \(foo.bar).baz (parens around the type), and,
furthermore, needing to distinguish \Foo?.bar from \Foo.?bar.

rdar://problem/31724243
2017-05-01 16:06:15 -07:00
Joe Groff
d5cdf658da KeyPaths: Generate _kvcKeyPathString for ObjC-compatible keypaths. 2017-04-21 16:56:17 -07:00