Commit Graph

3502 Commits

Author SHA1 Message Date
Dmitri Hrybenko
6a5f59831b Code completion: include access control keywords in override completion
When trying to implement deduplication of results, found and fixed an issue
with loose checks for generic overload checking.

rdar://17995317


Swift SVN r21276
2014-08-19 11:00:10 +00:00
Chris Lattner
d0718c119a fix ConstructorDecl::getDelegatingOrChainedInitKind to notice that an init
method has the convenience attribute on it when inferring the type of an
init that contains no self.init or super.init method.  This allows us to
properly infer that these things are delegating initializers, which trickles
down to emitting:

a.swift:7:3: error: self.init isn't called on all paths in delegating initializer

for:

  required convenience init(foo: Int) {
  }

instead of doing DI as though the initializer was a root init.



Swift SVN r21120
2014-08-08 23:04:36 +00:00
Doug Gregor
29108b932a Weak-link to Objective-C classes that Clang considers to be weak-imported.
This is a simple, trivialy, not-even-half-way-there solution to weak
leaking of Objective-C classes introduced after the deployment
target. It only works for Objective-C classes and C global variables
that Clang consideres to be "weak imported". However, this bare
minimum should be enough to develop an app (by jumping through various
hoops) that uses new functionality when its
available. <rdar://problem/17296490>, which I've restricted in scope
to capture this.

Swift SVN r20956
2014-08-02 19:33:36 +00:00
Greg Parker
c5b71e9e42 Don't use punycode when mangling names for Objective-C metadata.
Swift SVN r20886
2014-08-01 05:19:28 +00:00
Dmitri Hrybenko
fd0921b754 Redeclaration checking: disallow overloading on 'mutating'
rdar://17434759


Swift SVN r20819
2014-07-31 08:54:14 +00:00
Doug Gregor
e4b37bc105 Properly check whether we're in an extension when determining settability of a 'let' property.
We were checking for exact type equality of the DeclContexts, which
will not hold when extensions have their own archetypes. A near-term
fix would be to use interface types, but checking the nominal types is
a better long-term solution.

Swift SVN r20768
2014-07-30 20:27:33 +00:00
Doug Gregor
a0bc9274db Change parsing and representation of extensions to accommodate generic parameters.
The eventual goal for extensions of generic types is to require them
to specify their generic parameters, e.g.,

  extension Array<T> { ... }

rather than today's

  extension Array { ... }

Start parsing (optional) generic parameters here, and update the
representation of ExtensionDecl to accomodate this new grammar
production. Aside from the parser changes, there's no intended
functionality change here.

Swift SVN r20682
2014-07-29 19:17:00 +00:00
Doug Gregor
ac332429d9 Give extensions generic parameters and signatures within the AST.
This adds generic parameters and generic signatures to extension
declarations. The actual generic parameters just mirror what is
available on the extended type; however, it is filled in via extension
validation, which is handled lazily.

This is a NFC step toward decoupling the archetypes of extensions from
the archetypes of the extended types <rdar://problem/16974298>.

Swift SVN r20675
2014-07-29 16:20:56 +00:00
Jordan Rose
5c1e9d7d36 [Accessibility] Store setter accessibility explicitly.
Previously, we were just storing setter accessibility via the accessibility
level on the setter function. However, some Stored properties never actually
have a setter synthesized, which led to the compiler dropping the setter
accessibility at serialization time. Rather than try to hack up something
clever, just store the setter accessibility explicitly in every
AbstractStorageDecl. (We still only serialize it for VarDecls, because
settable SubscriptDecls always have setter functions.)

<rdar://problem/17816530>

Swift SVN r20598
2014-07-26 22:43:54 +00:00
Doug Gregor
ff92b5f007 Remove -[no]implicit-objc-with.
Toggling this option causes funny things to happen, and there's no
point in keeping it.

Swift SVN r20565
2014-07-25 22:13:46 +00:00
Argyrios Kyrtzidis
48c3e4144a [ASTPrinter] Print 'mutating/nonmutating' for accessors.
Swift SVN r20534
2014-07-25 07:26:26 +00:00
Dmitri Hrybenko
9aa5ef4128 Module interface printing: limit parameter underscoring rule to constructors.
Still have a few constructors to underscore.


Swift SVN r20404
2014-07-23 15:50:55 +00:00
Dmitri Hrybenko
315b400e36 Module interface printing: drop the rule that variables of underscored type are
also considered underscored.

No change in stdlib interface.


Swift SVN r20403
2014-07-23 15:38:40 +00:00
Dmitri Hrybenko
2f78896f05 Module interface printing: drop the rule that functions that mention
underscored types are also considered underscored.

No change in stdlib interface.


Swift SVN r20402
2014-07-23 15:34:21 +00:00
Chris Lattner
48687380b7 now that DeclAttributes is a single word, there is no reason to deal with
it indirectly through another pointer from Decl, just embed DeclAttributes
directly into Decl and get rid of the "getMutableAttrs" nonsense.



Swift SVN r20216
2014-07-20 04:09:42 +00:00
Joe Groff
7f5696fd11 SILGen: Make @objc final decls work correctly.
They don't get dispatched, but we should go through their native entry point instead of the ObjC thunk. Fixes <rdar://problem/17606834>.

Swift SVN r20105
2014-07-17 17:50:06 +00:00
Chris Lattner
195a4b38a3 Reapply r20101: switch 'convenience' from being a specially handles contextual keyword to being a decl modifier just like the rest, this elimiantes a bunch of special case code for handling it.
Swift SVN r20103
2014-07-17 17:27:54 +00:00
Chris Lattner
d2315f2bd8 revert r20101, I built one tree and tested another.
Swift SVN r20102
2014-07-17 17:12:31 +00:00
Chris Lattner
9b0d88e800 switch 'convenience' from being a specially handles contextual keyword
to being a decl modifier just like the rest, this elimiantes a bunch of
special case code for handling it.


Swift SVN r20101
2014-07-17 17:08:32 +00:00
Dmitri Hrybenko
527fbf5893 Module interface printing: change the implementation of the underscore rule so
that important protocols are not hidden

The rule essentially remains the same -- underscored symbols are stdlib
implementation details and users should not be relying on them.  (Even
protocols like _Collection, are conceptually implementation details -- they are
not a part of the original design and we would like to remove them as soon as
the bugs are fixed.)

But since protocols define requirements for user types, we need to display even
underscored protocols, except for _Builtin* protocols, which can never be
satisfied by a user type.

rdar://16986307


Swift SVN r20083
2014-07-17 13:38:31 +00:00
Chris Lattner
2825b9f5f8 move @transparent and @requires_stored_property_inits to the new attribute model.
All that is left is unowned(unsafe) & weak.



Swift SVN r20012
2014-07-16 06:14:19 +00:00
Joe Groff
42c7002dcf SILGen: @NSManaged property accessors always use objc dispatch.
Swift SVN r20004
2014-07-16 04:45:18 +00:00
Jordan Rose
7ee33aa3bf If a type is used as a superclass, force-generate its implicit initializers.
Our poor non-resilient vtables can't handle new methods being added to
superclasses, so when we do vtable layout we need to know that the
superclass is complete. If the superclass's initializers were never needed,
though, we would have never added them to the vtable, and we'd end up with
the wrong offset for all subclass methods.

<rdar://problem/17645615>

Swift SVN r19998
2014-07-16 01:40:40 +00:00
Chris Lattner
a3c17dc166 move the @infix/@postfix/@prefix attributes onto the modern attribute infrastructure, NFC.
Swift SVN r19927
2014-07-14 14:30:26 +00:00
Doug Gregor
a5c079af59 Replace the class_protocol attribute with a "class" requirement.
This only tackles the protocol case (<rdar://problem/17510790>); it
does not yet generalize to an arbitrary "class" requirement on either
existentials or generics.

Swift SVN r19896
2014-07-13 06:57:48 +00:00
Dave Abrahams
6d1095f44e Protocol names end in "Type," "ible," or "able"
Mechanically add "Type" to the end of any protocol names that don't end
in "Type," "ible," or "able."  Also, drop "Type" from the end of any
associated type names, except for those of the *LiteralConvertible
protocols.

There are obvious improvements to make in some of these names, which can
be handled with separate commits.

Fixes <rdar://problem/17165920> Protocols `Integer` etc should get
uglier names.

Swift SVN r19883
2014-07-12 17:29:57 +00:00
Sonny Falk
26206d95a5 [AST] Add the braces source range to invalid VarDecl nodes that have rejected
accessors due to syntax errors.
This allows AST clients to consult the source range of the braces for
computed properties even when there are errors.
Addresses the first part of <rdar://problem/16747499>.

Swift SVN r19843
2014-07-11 02:20:51 +00:00
Joe Groff
47d04ddba8 AST: Always require objc dispatch on foreign accessors.
Swift SVN r19842
2014-07-11 00:53:21 +00:00
Joe Groff
eaf84f5f0e SILGen: Use the 'dynamic' attribute to decide whether to emit ObjC dispatches.
When -enable-dynamic is passed, only require ObjC dispatch for 'dynamic' methods and accessors instead of for all @objc entities.

Swift SVN r19839
2014-07-11 00:12:25 +00:00
Chris Lattner
5b49d59c57 Remove the @ from @final and @lazy, the last major piece of
rdar://17168115.

Also, reinstate the ARM driver change and testcase that I removed
in my last patch.


Swift SVN r19790
2014-07-10 06:23:27 +00:00
Jordan Rose
5b80dc3d44 Respect accessibility for scoped imports.
"import var Foo.bar" should error if "Foo.bar" is not public.

Swift SVN r19747
2014-07-09 22:10:20 +00:00
Joe Groff
c1228c774d ClangImporter: Track when structs have unreferenceable storage.
SIL SROA needs to know when a struct's visible fields actually completely make up the struct value, which becomes an issue if we start importing structs with yet-unrepresentable unions and bitfields. Track this in the ClangImporter, and add an 'aggregateHasUnreferenceableStorage' predicate to SILType to make it easy for passes to query. Part of <rdar://problem/17555966>.

Swift SVN r19720
2014-07-09 03:52:15 +00:00
Chris Lattner
02999cac51 Reinstate the @ on the @objc attribute. This is largely a revert of r19555 with a few tweaks.
Swift SVN r19706
2014-07-08 21:50:34 +00:00
Jordan Rose
faa4004b42 [Accessibility] Public types/functions cannot have private generic parameters.
Or rather, they cannot have constraints on their generic parameters that use
private types.

Swift SVN r19644
2014-07-07 22:52:29 +00:00
Jordan Rose
132a29eb67 Remove unnecessary wrapper type GenericParam.
This always wrapped a single GenericTypeParamDecl *, and provided no benefit
over just using the decl directly.

No (intended) functionality change.

Swift SVN r19628
2014-07-07 20:51:50 +00:00
Chris Lattner
7a56499d61 Start making @objc not start with an @ sign:
- Change the parser to accept "objc" without an @ sign as a contextual
   keyword, including the dance to handle the general parenthesized case.
 - Update all comments to refer to "objc" instead of "@objc".
 - Update all diagnostics accordingly.
 - Update all tests that fail due to the diagnostics change.
 - Switch the stdlib to use the new syntax.

This does not switch all tests to use the new syntax, nor does it warn about
the old syntax yet.  That will be forthcoming.  Also, this needs a bit of 
refactoring, which will be coming up.



Swift SVN r19555
2014-07-04 05:57:57 +00:00
Argyrios Kyrtzidis
d67b3d5b08 [IDE] Provide the type source range for parameters in the syntax model.
rdar://17074991

Swift SVN r19249
2014-06-26 20:59:44 +00:00
Ted Kremenek
a3b704ec42 Mark all imported APIs deprecated in iOS 7 (or earlier) or OS 10.9 (or earlier) as unavailable.
This patch takes care that synthesized initializers are created
when overriding unavailable initializers (thanks Doug).

Swift SVN r19202
2014-06-26 00:50:46 +00:00
Jordan Rose
8a38f4d441 Add accessibility properties to ValueDecl and ExtensionDecl.
We're out of bits in ValueDecl's normal bitfields, so cram it in alongside
the type instead.

Swift SVN r19142
2014-06-24 21:32:09 +00:00
Chris Lattner
6f7a8d87de re-re-commit r19052 with a new fix to make it correct in erroneous cases, avoiding breaking the testsuite.
Swift SVN r19124
2014-06-24 05:04:15 +00:00
Jordan Rose
db3914e94b Disallow conforming to ObjC protocols with requirements that can't be imported.
For example, variadic ObjC method requirements.

<rdar://problem/17366999>

Swift SVN r19121
2014-06-24 01:23:06 +00:00
Ben Langmuir
67182f4964 Revert "reinstate r19052 with a fix to ConstructorDecl::getDelegatingOrChainedInitKind to make"
This reverts commit r19085, which broke the following tests.
  Swift :: Constraints/super_constructor.swift
  Swift :: expr/postfix/dot/init_ref_delegation.swift

Swift SVN r19098
2014-06-23 19:49:08 +00:00
Chris Lattner
fe14b2a264 reinstate r19052 with a fix to ConstructorDecl::getDelegatingOrChainedInitKind to make
it work with not-fully-typechecked asts.  It is gross that a big chunk of Sema got 
thrown into an AST method. :(


Swift SVN r19085
2014-06-22 21:38:01 +00:00
Greg Parker
1e721ba4cb Revert r19052 because it breaks Interpreter/SDK/block_calls.swift.
Swift SVN r19062
2014-06-21 01:49:09 +00:00
Chris Lattner
7a15e4b479 Don't allow delegating initializers in value types to mutate let
properties either.  Thanks Joe.


Swift SVN r19052
2014-06-20 21:09:49 +00:00
Chris Lattner
11c1a87e3a fix <rdar://problem/17400366> let properties should not be mutable in convenience initializers
Swift SVN r19051
2014-06-20 20:56:32 +00:00
Chris Lattner
02bc843f79 fix <rdar://problem/17051675> Structure initializers in an extension cannot assign to constant properties
Swift SVN r19037
2014-06-20 05:45:20 +00:00
Chris Lattner
50f96500fc fix <rdar://problem/16789886> Assert on protocol property requirement without a type
Swift SVN r19035
2014-06-20 05:20:49 +00:00
Argyrios Kyrtzidis
6054e2e685 [AST] Hide as private symbols that use types from the Builtin module.
rdar://17053694

Swift SVN r18657
2014-05-28 21:17:44 +00:00
Argyrios Kyrtzidis
829473a5dd [AST] Print a 'public' typealias with a 'private' underlying type by printing the declaration but not its underlying type.
Swift SVN r18656
2014-05-28 21:17:42 +00:00