Commit Graph

19 Commits

Author SHA1 Message Date
Harlan
2aac8863f6 [InterfaceGen] Only print 'mutating' and 'nonmutating' on accessors (#19459)
* [InterfaceGen] Only print 'mutating' and 'nonmutating' on accessors

* Add SILGen test for usage of dynamic accessors in and out of interfaces

* Add -enable-objc-interop to dynamic_accessors test
2018-09-25 23:10:52 -07:00
Harlan
bccca6ad1e [InterfaceGen] Don't print 'final' on accessors (#19399)
We've never allowed overriding specific accessors, and we don't
currently parse this syntax.
2018-09-19 18:53:30 -07:00
Huon Wilson
7753383223 [AST] Add @_hasInitialValue to var/lets that have initializers.
The information about whether a variable/property is initialized is lost in the
public interface, but is, unfortunately, required because it results in a symbol
for the initializer (if a class/struct `init` is inlined, it will call
initializers for properties that it doesn't initialize itself). This is
important to preserve for TBD file generation.

Using an attribute rather than just a bit on the VarDecl means this fits into
the scheme for module interfaces: textual/valid Swift.
2018-08-07 09:54:35 +10:00
Doug Gregor
363ef63409 [Code completion] Split out tests that require Objective-C interop.
A bunch of tests that technically require Objective-C interop were
not labeled as such, and worked in the absence of Objective-C interop
due to bugs in the type checker.
2018-07-18 21:17:12 -07:00
Doug Gregor
b70466dc63 [Type Checker] Add a request kind for computing 'ValueDecl::isObjC()'.
Still a WIP
2018-07-18 14:50:39 -07:00
Slava Pestov
719fcc0d2b Migrate two more Sema tests to Swift 4 2018-07-03 16:03:07 -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
Slava Pestov
7bbc2ae169 ASTPrinter: Print 'static' after attributes for PatternBindingDecls 2017-06-22 15:09:34 -07:00
Slava Pestov
da80c42a76 Sema: Don't infer 'dynamic' for static methods and properties
Otherwise, can crash in the AST verifier.

Fixes <rdar://problem/32862136>.
2017-06-21 16:23:05 -07:00
Jordan Rose
446a824c53 Don't infer 'dynamic' on accessors in extensions of ObjC classes.
Instead, propagate the decision from the associated storage decl (var
or subscript), using the mechanisms that are already in place.

rdar://problem/29741743
2016-12-20 14:19:53 -08:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Arnold Schwaighofer
723e2f912f TypeChecker: Fix implicit dynamic inference for extensions methods
Even if the method is marked override we need to emit an objective C method
call.

There is no v-table guarantee because of the override keyword. The base class
method might be in an objective c class.

rdar://27389992
2016-08-01 15:32:57 -07:00
Ben Langmuir
df62c78f11 Update a few tests I missed with the subscript printing change 2016-02-12 16:53:50 -08:00
Jordan Rose
8106a11dac Disallow @objc on non-ObjC-rooted classes.
These classes don't show up well in generated headers (rdar://problem/20855568),
can't actually be allocated from Objective-C (rdar://problem/17184317), and
make the story of "what is exposed to Objective-C" more complicated. Better
to just disallow them.

All classes are still "id-compatible" in that they can be converted to
AnyObject and passed to Objective-C, they secretly implement NSObjectProtocol
(via our SwiftObject root class), and their members can still be individually
exposed to Objective-C.

The frontend flag -disable-objc-attr-requires-foundation-module will disable
this requirement as well, which is still necessary for both the standard
library and a variety of tests I didn't feel like transforming.

Swift SVN r29760
2015-06-27 16:27:56 +00:00
Doug Gregor
7ef5ba9ff9 Perform override checking prior to (and independent of) @objc computation.
Always perform override checking based on the Swift type
signatures, rather than alternately relying on the Objective-C
selectors. This ensures that we get consistent override behavior for
@objc vs. non-@objc declarations throughout, and we separately make
sure that the Objective-C names line up.

This also allows us to inherit @objc'ness correctly (which didn't
quite work before), including inferring the Objective-C selector/name
(the actual subject of rdar://problem/18998564).

Fixes rdar://problem/18998564.

Swift SVN r25392
2015-02-19 06:29:34 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Nadav Rotem
c005433696 Fix the tests that broke with r21137.
rdar://17890078



Swift SVN r21140
2014-08-12 01:40:04 +00:00
Nadav Rotem
accba56e0a Disable the code that adds the 'final' attribute based on access control.
This patch is a part of rdar://17890078



Swift SVN r21137
2014-08-11 21:54:56 +00:00
Doug Gregor
4c667c5df6 Infer "dynamic" for Objective-C methods introduced in class extensions.
When we introduce a method into a class extension (such that it does
not override any other method), we cannot add a vtable slot for that
method and therefore cannot perform dynamic dispatch on it without
going through objc_msgSend. To work around this bug
(<rdar://problem/17950064>), infer 'dynamic' for these cases, which
pushes us through objc_msgSend to get the appropriate semantics.

Note that we do *not* want this to interfere with inference of
'final', which means allowing 'final' inference to delete the
'dynamic' we introduce with the above.

Swift SVN r21135
2014-08-11 20:45:12 +00:00