Commit Graph

1994 Commits

Author SHA1 Message Date
Rintaro Ishizaki
4c0892fdc6 [CodeComplete] Strip out try and optional eval expr in operator compilation
foldSequence() may hoist these expression up by mutating their sub
expression. When completing operators, this behavior ruins reusability
of operand. Since these expression doesn't affect completion, we can
strip them out.

rdar://problem/42452085
2018-07-25 13:58:53 +09:00
swift-ci
9faf6b0cb1 Merge remote-tracking branch 'origin/master' into master-next 2018-07-24 16:49:28 -07:00
Rintaro Ishizaki
7ca7e4459d [IDE] Fix asstion failure when querying cursor info in defer statement body
If walking into body of defer statement returns nullptr, it indicates
*cutting-off* walking. Previously there was wrong assertion where it
must be unmodified, non-nullptr return.

rdar://problem/41100570
2018-07-25 08:33:46 +09:00
Rintaro Ishizaki
711cef6869 [Refactoring] Fix crasher in switch with non-nominal subject type
rdar://problem/42098130
2018-07-24 18:07:07 +09:00
swift-ci
73cb0a32f3 Merge remote-tracking branch 'origin/master' into master-next 2018-07-23 21:09:28 -07:00
David Ungar
1d68b11998 Merge pull request #18153 from davidungar/rdar-42314665-produces-no-output
Don’t dive into null parts of AST.
2018-07-23 20:55:41 -07:00
swift-ci
685b007c3f Merge remote-tracking branch 'origin/master' into master-next 2018-07-23 20:39:45 -07:00
John McCall
7a4aeed570 Implement generalized accessors using yield-once coroutines.
For now, the accessors have been underscored as `_read` and `_modify`.
I'll prepare an evolution proposal for this feature which should allow
us to remove the underscores or, y'know, rename them to `purple` and
`lettuce`.

`_read` accessors do not make any effort yet to avoid copying the
value being yielded.  I'll work on it in follow-up patches.

Opaque accesses to properties and subscripts defined with `_modify`
accessors will use an inefficient `materializeForSet` pattern that
materializes the value to a temporary instead of accessing it in-place.
That will be fixed by migrating to `modify` over `materializeForSet`,
which is next up after the `read` optimizations.

SIL ownership verification doesn't pass yet for the test cases here
because of a general fault in SILGen where borrows can outlive their
borrowed value due to being cleaned up on the general cleanup stack
when the borrowed value is cleaned up on the formal-access stack.
Michael, Andy, and I discussed various ways to fix this, but it seems
clear to me that it's not in any way specific to coroutine accesses.

rdar://35399664
2018-07-23 18:59:58 -04:00
David Ungar
a8136a29ba Don’t dive into null parts of AST. 2018-07-23 12:35:03 -07:00
swift-ci
c0d6b81349 Merge remote-tracking branch 'origin/master' into master-next 2018-07-23 00:49:34 -07:00
Slava Pestov
90cd772228 AST: Remove getParameterLists() and friends from AbstractFunctionDecl subclasses
Now, an AbstractFunctionDecl always stores a single parameter list.

Furthermore, ConstructorDecl and DestructorDecl always store a
ParamDecl for 'self'.

FuncDecl only has a 'self' if it is a member of a nominal type or
extension, so we tail-allocate the storage for it.
2018-07-22 20:56:56 -07:00
Slava Pestov
5213f80e7e IDE: Remove uses of AbstractFunctionDecl::getParameterLists() 2018-07-22 20:56:56 -07:00
Brent Royal-Gordon
e797fe5976 [IDE] Add call parens to postfix operator completion 2018-07-22 19:34:29 -07:00
swift-ci
8488851723 Merge remote-tracking branch 'origin/master' into master-next 2018-07-13 09:49:10 -07:00
Rintaro Ishizaki
fb9c65e108 [CodeComplete] Fix crasher when completing inout IUO variable
Use `PrintOptionalAsImplicitlyUnwrapped` option.

rdar://problem/40956846
2018-07-14 00:52:57 +09:00
swift-ci
baa7a26e25 Merge remote-tracking branch 'origin/master' into master-next 2018-07-11 11:09:20 -07:00
Ben Langmuir
b394e35fdd [codecomplete] Add completion of if after else
At some point we stopped completing keywords after `else` in an if
statement. Bring back the completion of `if`, which is the only valid
continuation other than a brace.

rdar://37467474
2018-07-10 11:45:10 -07:00
Ben Langmuir
2ace21276e [codecomplete] Factor common code for adding keyword completions NFC 2018-07-09 16:10:42 -07:00
swift-ci
dcc3937689 Merge remote-tracking branch 'origin/master' into master-next 2018-07-07 07:39:56 -07:00
Slava Pestov
19de53f6cf Sema: Remove dead code from access level computation rework 2018-07-06 23:50:36 -07:00
swift-ci
0b12c9a5fa Merge remote-tracking branch 'origin/master' into master-next 2018-07-06 00:49:00 -07:00
Slava Pestov
9f055beb55 Merge pull request #17783 from slavapestov/kill-lvalue-access-kind
Kill lvalue access kind
2018-07-06 00:39:26 -07:00
Slava Pestov
70732015f3 IDE: Stop using Expr::getLValueAccessKind() 2018-07-05 23:49:57 -07:00
Slava Pestov
03f1e13a50 IDE: Index references from keypaths 2018-07-05 23:33:59 -07:00
swift-ci
a93ce92de1 Merge remote-tracking branch 'origin/master' into master-next 2018-07-02 20:29:09 -07:00
Doug Gregor
793ba723f7 [AST] Delete the unused FileUnitKind::Derived.
The last use of this went away a loooooong time ago. NFC.
2018-07-02 13:32:39 -07:00
swift-ci
f3b8a3cbaf Merge remote-tracking branch 'origin/master' into master-next 2018-06-30 10:09:20 -07:00
John McCall
f81036202d Merge pull request #17566 from rjmccall/storage-impls
Generalize storage implementations to support generalized accessors
2018-06-30 12:58:33 -04:00
swift-ci
3026500f59 Merge remote-tracking branch 'origin/master' into master-next 2018-06-30 06:29:07 -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
Slava Pestov
1d2d653844 IDE: Redo typeCheckContext()
- Don't type check top-level contexts multiple times
- Use validateDecl() instead of typeCheckDecl() when possible
2018-06-30 00:20:37 -07:00
Bob Wilson
b254041121 Merge remote-tracking branch 'origin/master' into master-next 2018-06-28 23:23:29 -07:00
Rintaro Ishizaki
bccfd85b70 [CodeComplete] Typecheck SubscriptDecl context prior to completion
Completing signature depends on its GenericEnvironment which is set
during typechecking. Previously, completing signature using generic type
used to cause assertion failure. e.g.

  extension Collection {
    subscript(some index: Int) -> Iterator.<COMPLETE HERE>

rdar://problem/41227754
2018-06-28 17:39:07 +09:00
swift-ci
c76deeb160 Merge remote-tracking branch 'origin/master' into master-next 2018-06-27 18:09:29 -07:00
swift-ci
d3a11186e0 Merge pull request #17577 from DougGregor/mangle-bound-generic-protocol 2018-06-27 17:57:47 -07:00
Doug Gregor
58c5b020cb [Mangling] Handle mangling involving bound generic "protocols".
When mangling a specialized use of a typealias in a protocol, we end up
with a "bound generic protocol" mangling, with the one substitution
replacing Self with some other type. Handle de-mangling and
re-mangling of such names.

Fixes rdar://problem/41549126.
2018-06-27 16:43:29 -07:00
swift-ci
ff7e1a9aa9 Merge remote-tracking branch 'origin/master' into master-next 2018-06-27 15:49:33 -07:00
Rintaro Ishizaki
52e3109231 [CodeComplete] Restore original type in getOperatorCompletions
In getOperatorCompletions(), for each every known operators, temporary
expressions are created and typechecked. In this process, typechecker
may set the type of the parsed expression. That may cause non-accurate
completion results or crash at worst.

rdar://problem/28188259
2018-06-27 19:35:25 +09:00
Rintaro Ishizaki
8c970ab26d [CodeComplete] Handle assign expression in sequence completion
rdar://problem/41232519
rdar://problem/41159258
2018-06-27 19:35:25 +09:00
swift-ci
73dfb54717 Merge remote-tracking branch 'origin/master' into master-next 2018-06-26 18:10:02 -07:00
Doug Gregor
15f4ee7216 [Type reconstruction] Produce an error with # of generic arguments mismatch. 2018-06-26 13:48:13 -07:00
Doug Gregor
b3e536b333 [Type Reconstruction] Guard against wrong # of generic args for a typealias.
When we are attempting to reconstruct a type node for a generic typealias,
make sure that we get the right number of generic arguments. If not,
fail gracefully rather than crashing.

Eventually, we should be able to handle this nested case.
2018-06-26 13:48:13 -07:00
swift-ci
72392fa5d2 Merge remote-tracking branch 'origin/master' into master-next 2018-06-25 20:29:48 -07:00
Mark Lacey
100bffd325 Remove redundant nested if statement.
Noticed while browsing code.

NFC.
2018-06-25 17:49:53 -07:00
swift-ci
d48f380bfc Merge remote-tracking branch 'origin/master' into master-next 2018-06-22 18:49:53 -07:00
swift-ci
1b1eef737f Merge pull request #17445 from dcci/mynongenericsignaturepain 2018-06-22 18:34:23 -07:00
Davide Italiano
f657cfb49a [TypeReconstruction] Don't crash on null genericSignatureMap.
<rdar://problem/41343572>
2018-06-22 16:18:27 -07:00
Bob Wilson
44712233c3 Merge remote-tracking branch 'origin/master' into master-next 2018-06-21 23:36:03 -07:00
Adrian Prantl
360b1687ac Remove support for the obsolete Qualified Archetype mangling from everywhere. 2018-06-21 16:15:17 -07:00
Bob Wilson
425bbf2975 Merge remote-tracking branch 'origin/master' into master-next 2018-06-20 13:18:55 -07:00