Commit Graph

2357 Commits

Author SHA1 Message Date
swift-ci
c0d6b81349 Merge remote-tracking branch 'origin/master' into master-next 2018-07-23 00:49:34 -07:00
Slava Pestov
df9f7f979a Parse: Remove uses of getParameterLists() from default argument parsing 2018-07-22 20:56:56 -07:00
swift-ci
b4bae42909 Merge remote-tracking branch 'origin/master' into master-next 2018-07-21 13:49:33 -07:00
Slava Pestov
bfc4121971 AST: Rework AbstractFunctionDecl construction away from multiple parameter lists
There are two general constructor forms here:

- One took the number of parameter lists, to be filled in later.
  Now, this takes a boolean indicating if there is an implicit
  'self'.

- The other one took the actual parameter lists and filled them
  in right away. This now takes a separate 'self' ParamDecl and
  ParameterList.

Instead of storing the number of parameter lists, an
AbstractFunctionDecl now only needs to store if there is a 'self'
or not.

I've updated most places that construct AbstractFunctionDecls to
properly use these new forms. In the ClangImporter, there is
more code that remains to be untangled, so we continue to build
multiple ParameterLists and unpack them into a ParamDecl and
ParameterList at the last minute.
2018-07-21 07:30:30 -07:00
Bob Wilson
b2d8227a32 Merge remote-tracking branch 'origin/master' into master-next 2018-07-20 18:46:05 -07:00
John McCall
06edd256c2 Generalize the recording of parsed accessors.
As part of this, lift the now-unnecessary restriction against
combining a non-mutable addressor with a setter.  I've also
tweaked some of the diagnostics.

This is in preparation for generalized accessors.
2018-07-20 17:54:57 -04:00
swift-ci
80e4678ece Merge remote-tracking branch 'origin/master' into master-next 2018-07-19 14:29:44 -07:00
Slava Pestov
89c3d54034 Parse: Remove uses of AbstractFunctionDecl::getParameterLists() 2018-07-19 12:28:26 -07:00
swift-ci
196b29576c Merge remote-tracking branch 'origin/master' into master-next 2018-07-10 10:09:26 -07:00
Xi Ge
fd6b5941dd libSyntax: rename SyntaxParsingContext.setDiscard() to SyntaxParsingContext.setBackTracking(). NFC 2018-07-09 14:02:26 -07:00
Rintaro Ishizaki
d9746f2067 [Parse] Drop Swift3 support for misc diagnostics
Several diagnostics were warnings in Swift3, but errors in Swift4+

Related: https://github.com/apple/swift/pull/10908
2018-07-07 23:28:36 +09:00
swift-ci
ed21529b6f Merge remote-tracking branch 'origin/master' into master-next 2018-07-06 10:48:57 -07:00
Hamish Knight
c66e68fb93 [Parse][Sema] Emit immediate deallocation warning on the '=' token for PBDs (#17700)
Pass through the location of the equal '=' token for pattern binding decl entries, and use this location for the immediate deallocation diagnostic. Previously, we were just diagnosing on the start of the initialiser expression.

Additionally, this commit moves the call to `diagnoseUnownedImmediateDeallocation` from `typeCheckBinding` to `typeCheckPatternBinding`. This not only gives us easier access to the PBD entry, but also avoids calling the diagnostic logic for statement conditions such as `if let x = <expr>`. We currently never diagnose on these anyway, as the 'weak' and 'unowned' keywords cannot be applied to such bindings.

Resolves [SR-7340](https://bugs.swift.org/browse/SR-7340).
2018-07-06 10:47:49 -07:00
swift-ci
f3b8a3cbaf Merge remote-tracking branch 'origin/master' into master-next 2018-06-30 10:09:20 -07:00
John McCall
9bee3cac5a Generalize storage implementations to support generalized accessors.
The storage kind has been replaced with three separate "impl kinds",
one for each of the basic access kinds (read, write, and read/write).
This makes it far easier to mix-and-match implementations of different
accessors, as well as subtleties like implementing both a setter
and an independent read/write operation.

AccessStrategy has become a bit more explicit about how exactly the
access should be implemented.  For example, the accessor-based kinds
now carry the exact accessor intended to be used.  Also, I've shifted
responsibilities slightly between AccessStrategy and AccessSemantics
so that AccessSemantics::Ordinary can be used except in the sorts of
semantic-bypasses that accessor synthesis wants.  This requires
knowing the correct DC of the access when computing the access strategy;
the upshot is that SILGenFunction now needs a DC.

Accessor synthesis has been reworked so that only the declarations are
built immediately; body synthesis can be safely delayed out of the main
decl-checking path.  This caused a large number of ramifications,
especially for lazy properties, and greatly inflated the size of this
patch.  That is... really regrettable.  The impetus for changing this
was necessity: I needed to rework accessor synthesis to end its reliance
on distinctions like Stored vs. StoredWithTrivialAccessors, and those
fixes were exposing serious re-entrancy problems, and fixing that... well.
Breaking the fixes apart at this point would be a serious endeavor.
2018-06-30 05:19:03 -04:00
swift-ci
69be2c0150 Merge remote-tracking branch 'origin/master' into master-next 2018-06-26 09:49:25 -07:00
Graydon Hoare
c2d67d8eaa [Parse] <rdar://41154797> Detect eof in non-string-arg recovery loop in #error arg list. 2018-06-25 23:39:55 -07:00
swift-ci
4538ce9818 Merge remote-tracking branch 'origin/master' into master-next 2018-06-17 15:38:24 -07:00
John McCall
69f4dd1ec9 Generalize accessor storage to preserve the original accessor list.
Only not NFC because it's detectable by source tools.
2018-06-16 18:16:31 -04:00
swift-ci
bfe796b93e Merge remote-tracking branch 'origin/master' into master-next 2018-06-16 01:32:31 -07:00
Doug Gregor
18569e5f77 Merge pull request #16963 from DougGregor/evaluator-type-checker
[Type checker] Use the request-evaluator in the type checker.
2018-06-15 22:41:31 -07:00
Bob Wilson
5df3d1f100 Merge remote-tracking branch 'origin/master' into master-next 2018-06-14 20:51:48 -07:00
Slava Pestov
de9f3bb37c Parse: Remove unused findFirstNonNull() function 2018-06-14 16:03:34 -07:00
Doug Gregor
b7fbe57bf9 [AST] Remove “validated” bit from TypeLoc.
TypeLocs have been “validated” when they have a non-null Type, so eliminate
the separate “validated” bit that was out-of-sync with the Type field.
2018-06-14 15:29:57 -07:00
John McCall
9022b5152f Rename accessor kinds from IsGetter -> IsGet, etc.
Introduce some metaprogramming of accessors and generally prepare
for storing less-structured accessor lists.

NFC except for a change to the serialization format.
2018-06-14 17:08:55 -04:00
Bob Wilson
c3e02955bb [master-next] Adjust for VersionTuple moving from clang to llvm.
LLVM r334399 (and related Clang changes) moved clang::VersionTuple to
llvm::VersionTuple. Update Swift to match.

Patch by Jason Molenda.
rdar://problem/41025046
2018-06-12 16:44:11 -07:00
Slava Pestov
00cb08d9b3 Parse: Only diagnose renamed @_inlineable and @_versioned in -swift-version 4.2
Normally we don't gate *warnings* on -swift-version flags, but
SwiftNIO makes use of @_inlineable / @_versioned and wants to
continue building with Swift 4.1 until 4.2 is released.

Fixes <https://bugs.swift.org/browse/SR-7578>,
<rdar://problem/40717640>.
2018-06-09 22:41:54 -07:00
enomoto
bfff091fa8 Fix error message for a subscript without accessors says "computed property" 2018-06-08 20:45:05 -07:00
Mox Soini
965124708a Better error message for 'class func/var' usage in protocols 2018-06-04 08:49:28 +03:00
Rintaro Ishizaki
7c4aaef4f5 [CodeCompletion] Disable completion for declaration name position (#16898)
Code completion should not suggest anything when declaring a new name.

rdar://problem/29392238
2018-05-30 12:29:58 -07:00
Alex Hoppen
9d3233c556 [incrParse] Allow reuse of MemberDeclListItems 2018-05-22 08:52:38 -07:00
Alex Hoppen
b904194998 [libSyntax] Add support for parsing #sourceLocation directives 2018-05-22 08:52:31 -07:00
Wesley Wickwire
9e8f8d9acb centralized it a little better 2018-05-15 00:16:49 -04:00
Wesley Wickwire
d0c1fd6e72 added suggestion for inlinable misspelling 2018-05-14 23:53:10 -04:00
Rintaro Ishizaki
a6f7a8ea35 [Parser] Set local discriminator to ParamDecls
We have to discriminate between params and local variables.
2018-05-11 15:37:40 +09:00
Rintaro Ishizaki
df10afd1a2 [Parse] Discriminate local variables
Set local discriminator for all local `VarDecl`s. Otherwise, they cannot
be discriminated with USRs. This change is needed for rename refactoring which
uses USR for discrimiating variable names.

https://bugs.swift.org/browse/SR-7205,
rdar://problem/34701880
2018-05-11 15:34:42 +09:00
Pavel Yaskevich
adfaf8bab4 Merge pull request #16394 from xedin/rdar-39909829
[Parser] Set decl context to be typealias when completing its underly…
2018-05-07 14:14:37 -07:00
Kazutaka Homma
cfc91fd7b3 [SR-6996]Better diagnostic when declaring a class inheritance with parentheses (#15010)
add diagnosis for python style inheritance clause
2018-05-07 13:27:08 +09:00
Pavel Yaskevich
f49aad16b7 [Parser] Set decl context to be typealias when completing its underlying type
Parser didn't capture correct context when code completion
was attempted on typealias' right-hand side which, if there are
generic parameters present, would result in a crash. These
changes make it so completion gets a correct declaration
context in aforementioned case and typealias declaration is marked
invalid because it doesn't have a proper type.

Resolves: rdar://problem/39909829
2018-05-04 17:39:55 -07:00
Alex Hoppen
4c1b27db83 [libSyntax] Fix parsing of delayed function bodies 2018-04-27 21:05:36 -07:00
Alex Hoppen
82df80ad9d [libSyntax] Allow declarations with external asm name to not have a body
This covers declarations of functions with the @_silgen_name attribute
used in the stdlib.
2018-04-27 21:03:19 -07:00
Alex Hoppen
05350cd0bb [libSyntax] Fix parsing of delayed function bodies 2018-04-27 08:10:19 -07:00
Alex Hoppen
94b8a3545b [libSyntax] Fix parsing for KeyPath 2018-04-25 13:30:31 -07:00
Alex Hoppen
28973f23b6 [libSyntax] Fix parsing of member declarations with trailing semicolon 2018-04-24 14:19:24 -07:00
Alex Hoppen
c6a11097e8 [libSyntax] Fix parsing of #if inside type declarations 2018-04-24 14:16:11 -07:00
Alex Hoppen
3e9ae802c2 [libSyntax] Make parsing of attribute arguments more structured
This also fixes several issues where attribute arguments could not be
parsed as a TokenList since some of its arguments already had structure
and were not tokens
2018-04-24 13:18:15 -07:00
Alex Hoppen
75406c895c [libSyntax] Enable parsing of class restrictions for protocols 2018-04-23 12:23:27 -07:00
Rintaro Ishizaki
f1202c4563 Merge pull request #15891 from rintaro/syntax-operator-selector
[Syntax] Parse 'operator' decl and '#selector' expr syntax.
2018-04-13 15:45:43 +09:00
Rintaro Ishizaki
203496f048 [Parse] Hoist diagnostics for named 'subscript'/'init'
Mainly for code readability.
2018-04-13 11:58:33 +09:00
Rintaro Ishizaki
eb69497d64 [Syntax] Parse 'operator' declaration syntax 2018-04-12 13:55:55 +09:00