Commit Graph

889 Commits

Author SHA1 Message Date
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
Argyrios Kyrtzidis
c5e19b4afd [AST] Hide operator '~>' as an internal symbol.
Swift SVN r18628
2014-05-25 20:42:23 +00:00
Argyrios Kyrtzidis
adb17b5aca [AST] If a symbol has a type of a typealias that is not with leading underscore, accept it as public one.
Note that if the typealias type is an internal one it will show up undeclared in the interface.
We currently allow this to avoid unintentionally hiding a public API.

Swift SVN r18627
2014-05-25 20:06:02 +00:00
Argyrios Kyrtzidis
95bd9e1d28 [AST/IDE] Centralize the logic to determine if a symbols is a 'private' stdlib one and hide them more extensively.
-Hide vars that have a private type.
-Hide functions that have a parameter with private type or a parameter name with leading underscore.
-Minor change in StringUTF16.swift to avoid printing "func generate() -> IndexingGenerator<_StringCore>".

rdar://17027294

Swift SVN r18623
2014-05-25 03:49:02 +00:00
Joe Pamer
c81e822ef5 Add some logic to the type checking process to prevent stack overflows while type checking certain kinds of self-referential declarations. This addresses rdar://problem/1641865, rdar://problem/16994520 and host of other radars that have been filed over the past several months.
Post-WWDC, we need to update the type checking process to make these kinds of infinite loops impossible without checking special flags.

Swift SVN r18598
2014-05-23 18:19:29 +00:00
Chris Lattner
0d8c93b186 fix <rdar://problem/16889110> capture lists in lazy member properties cannot use self
When reparenting a closure in an @lazy initializer into the computed getter, make sure
to reparent any var/pbd decls in the capture list into the same context.



Swift SVN r18365
2014-05-18 22:40:56 +00:00
Chris Lattner
cf55f7edd5 fix:
<rdar://problem/16264989> property not mutable in closure inside of its willSet
and:
<rdar://problem/16826319> willSet immutability behavior is incorrect

by changing how we handle immutability of an observing property within its willSet.
Instead of trying to model it as an rvalue, just model it as an lvalue (which it is)
and diagnose the problem with a warning in MiscDiagnostics.



Swift SVN r18184
2014-05-16 06:32:33 +00:00
Argyrios Kyrtzidis
2fe6987c5a [IDE] Annotate 'convenience' in an initializer as keyword.
rdar://16855149

Swift SVN r18065
2014-05-14 05:51:09 +00:00
Argyrios Kyrtzidis
2d1f1b1386 Fix ConstructorDecl::getSourceRange() to return the signature range if there is no body, not the range of its containing type declaration.
Swift SVN r18046
2014-05-14 00:41:12 +00:00
Chris Lattner
46a2939e5d try to unbreak the bot.
Swift SVN r17873
2014-05-11 14:55:42 +00:00
Doug Gregor
b6e915e7e5 Introduce "with" into method names that have keyword arguments as their first argument.
Only do this when neither the first word of the keyword argument nor
the last word of the base method name is a preposition. This is the
last semantic part of <rdar://problem/16795899>.

Swift SVN r17782
2014-05-09 16:26:01 +00:00
Doug Gregor
90726dfdb3 When the first argument of a method name is API, add it to the first selector piece of the @objc selector.
Swift SVN r17780
2014-05-09 16:25:59 +00:00
Jordan Rose
de4c0ee8a8 Simplify a check to see if a particular struct is Swift.String.
ASTContext knows how to find this type now.

No functionality change.

Swift SVN r17572
2014-05-06 22:50:30 +00:00
Joe Groff
05c80a8fe9 AST: Avoid instantiating all members when implicit destructors are inserted into classes.
We were accidentally forcing all members of a class to be instantiated in two places:

- by trying to look up an existing destructor decl in the class, and
- by adding the implicit destructor to the class, because addMember needlessly called loadAllMembers.

Fix the former problem by adding a 'has destructor' bit to ClassDecl so we can track whether the implicit destructor needs to be added without querying its members. Fix the latter by making IterableDeclContext::addMember not call loadAllMembers, and making loadAllMembers not barf when it sees existing members in the context.

Together with Jordan and JoeP's changes, this makes many interpreter tests now compile 3-20x faster.

Swift SVN r17562
2014-05-06 20:30:08 +00:00