Commit Graph

1735 Commits

Author SHA1 Message Date
Rintaro Ishizaki
c01eb93e9a [CodeCompletion][NFC] Use ASTWalker::ParentTy instead of ASTNode
in 'ExprParentFinder'. There's no reason to re-pack into ASTNode.
2018-08-09 19:48:23 +09:00
Rintaro Ishizaki
d898f6d664 [CodeCompletetion] Handle binary/unary expression in context type analyzer
Don't discard parsed expression in Parser. This improves type inference
for CodeCompletionExpr.
2018-08-09 19:48:23 +09:00
Rintaro Ishizaki
0dfbf76354 [CodeCompletion] Improve getReturnTypeFromContext()
* For methods, un-curry function interface type so we can get declared
return type.
* For closures, fall back to getting explicit result type in case we
cannot retrieve it from the type of closure itself.
2018-08-09 19:48:16 +09:00
Rintaro Ishizaki
4e1147df04 [IDE][gardening] Inline getPositionInTupleExpr() 2018-08-07 12:57:14 +09:00
Rintaro Ishizaki
f04be1457c [IDE][gardening] Inline overloaded collectArgumentExpectation 2018-08-07 12:57:14 +09:00
Rintaro Ishizaki
733e96b877 [IDE][gardening] Refactoring around collectArgumentExpectation() 2018-08-07 11:43:05 +09:00
Rintaro Ishizaki
46d418f232 [IDE][gardening] Factor out getPositionInArgs()
This function get the index of specified expression in the arguments.
2018-08-07 11:43:05 +09:00
Rintaro Ishizaki
81cae7309d [IDE][gardening] Rename collectionInputTypes()
To 'collectPossibleParamLists()'.
2018-08-07 11:43:05 +09:00
Rintaro Ishizaki
6088b794a8 [IDE][gardening] Removed unused function
The last usage have been removed in
c0f5711ee5.
2018-08-07 10:42:54 +09:00
swift-ci
71f0248b0a Merge remote-tracking branch 'origin/master' into master-next 2018-08-06 11:07:55 -07:00
Doug Gregor
3018becde7 [Type checker] Eliminate type checking from early extension binding.
Use ExtensionDecl::getExtendedNominal() to wire up extensions to their
nominal types early in type checking (the bindExtensions()) operation,
rather than going through type validation to do so.
2018-08-03 11:26:49 -07:00
Doug Gregor
bd5f5d80e4 [AST] Add ExtensionDecl::getExtendedNominal().
Introduce ExtensionDecl::getExtendedNominal() to provide the nominal
type declaration that the extension declaration extends. Move most
of the existing callers of the callers to getExtendedType() over to
getExtendedNominal(), because they don’t need the full type information.

ExtensionDecl::getExtendedNominal() is itself not very interesting yet,
because it depends on getExtendedType().
2018-08-03 11:26:48 -07:00
swift-ci
91d78b5212 Merge remote-tracking branch 'origin/master' into master-next 2018-08-01 19:28:59 -07:00
Rintaro Ishizaki
49f6a28637 [IDE] Use collected token to retrieve range of type identifier
Previously, it used to use length from AST. Because AST doesn't necessarily
holds actual source information, it may emits inacculate syntax info
which cause mis-coloring or compiler crash in the worst case. Instead, use
collected token info which contains actual token length.

https://bugs.swift.org/browse/SR-8378
rdar://problem/42653982
2018-08-02 10:02:58 +09:00
swift-ci
5830e237ff Merge remote-tracking branch 'origin/master' into master-next 2018-07-31 13:29:50 -07:00
Doug Gregor
9eb9898321 Merge pull request #18364 from DougGregor/name-lookup-requests
[Name lookup] Introduce requests for several name lookup operations.
2018-07-31 13:23:38 -07:00
Jordan Rose
2dfa303975 [Serialization] Preserve source order in serialization (#18361)
We previously shied away from this in order to not /accidentally/
depend on it, but it becomes interesting again with textual
interfaces, which can certainly be read by humans. The cross-file
order is the order of input files, which is at least controllable by
users.
2018-07-31 13:15:07 -07:00
Doug Gregor
792d934e3e [Clang importer] Avoid recursion through isObjC more directly.
Also address some review comments related to the name lookup requests.
2018-07-31 10:20:15 -07:00
Doug Gregor
d07fa5ab69 Switch many callers of ClassDecl::getSuperclass() to ClassDecl::getSuperclassDecl().
ClassDecl::getSuperclass() produces a complete interface type describing the
superclass of a class, including any generic arguments (for a generic type).
Most callers only need the referenced ClassDecl, which is (now) cheaper
to compute: switch those callers over to ClassDecl::getSuperclassDecl().

Fixes an existing test for SR-5993.
2018-07-31 10:14:44 -07:00
Doug Gregor
2860557a77 [Name lookup] Use the declaration-based lookupQualified() where it’s easy.
Switch a number of callers of the Type-based lookupQualified() over to
the newer (and preferred) declaration-based lookupQualified(). These are
the easy ones; NFC.
2018-07-31 10:14:44 -07:00
swift-ci
158cf1f948 Merge remote-tracking branch 'origin/master' into master-next 2018-07-30 10:29:13 -07:00
Pavel Yaskevich
0781aee89c Merge pull request #16896 from xedin/cs-params-cache
[CSSolver] Add closure parameter type caching
2018-07-30 10:17:55 -07:00
swift-ci
be19f650fd Merge remote-tracking branch 'origin/master' into master-next 2018-07-30 10:08:59 -07:00
Xi Ge
4b379db1bf Merge pull request #18231 from keith/ks/indent-closing-square
IDE: Fix formatting of closing square brackets
2018-07-30 09:51:32 -07:00
swift-ci
0e773085ef Merge remote-tracking branch 'origin/master' into master-next 2018-07-30 09:49:19 -07:00
Rintaro Ishizaki
f4fc479818 [IDE] Handle MakeTemporarilyEscapableExpr in SemaAnnotator 2018-07-30 09:50:37 +09:00
Rintaro Ishizaki
1a624413c6 [IDE] Handle OpenExistentialExpr in SemaAnnotator
As for `OpenExistentialExpr`, normal ASTWalker walks into the existential
expression first, then walks into sub expression. However,
`SourceEntitiyWalker` must walk AST tree by source order. Handle
`OpenExistentialExpr` and its `OpaqueValueExpr` so that
`SourceEntityWalker` walks to them in "outer to inner" manner.

rdar://problem/41147733
2018-07-30 09:50:37 +09:00
Pavel Yaskevich
0a404529c3 [Sema] Adjust Diagnostics/IDE to not assume that parameters always have types 2018-07-28 20:28:41 -07:00
swift-ci
ce3c206eee Merge remote-tracking branch 'origin/master' into master-next 2018-07-26 13:09:13 -07:00
Xi Ge
bff3f8adcc Merge pull request #16983 from mohitathwani/SR-7292
[WIP] Generating member wise initializer with local refactoring
2018-07-26 13:05:08 -07:00
Mohit Athwani
ce1122921a SR-7292 - Refactoring tool for generating member wise init 2018-07-26 11:31:30 -07:00
Keith Smiley
2d91af2077 IDE: Fix formatting of closing square brackets
Previously closing square brackets would be caught in the logic for
elements in collections, indenting them to the same level. Now they are
indented with the normal non-sibling logic, which indents them
correctly.
2018-07-25 20:27:32 -07:00
swift-ci
b456a11c2e Merge remote-tracking branch 'origin/master' into master-next 2018-07-25 17:29:24 -07:00
swift-ci
78cacf2a80 Merge remote-tracking branch 'origin/master' into master-next 2018-07-25 16:09:16 -07:00
Rintaro Ishizaki
9e7fa99689 [CodeComplete] Use PrintOptionalAsImplicitlyUnwrapped to print IUO
Other instances of fb9c65e. Consistently use
PrintOption.PrintOptionalAsImplicitlyUnwrapped to print IUO.

rdar://problem/41046225
rdar://problem/42443512
2018-07-26 07:55:25 +09:00
Rintaro Ishizaki
0547f1bcdc Merge pull request #18209 from rintaro/ide-compilation-rdar42452085
[CodeComplete] Strip out try and optional eval expo in operator completion
2018-07-26 07:52:19 +09:00
swift-ci
879a10aa57 Merge remote-tracking branch 'origin/master' into master-next 2018-07-25 15:29:05 -07:00
Rintaro Ishizaki
395885505a Merge pull request #18198 from rintaro/ide-rdar41100570
[IDE] Fix asstion failure when querying cursor info in defer statement body
2018-07-26 07:13:32 +09:00
swift-ci
69e82c2578 Merge remote-tracking branch 'origin/master' into master-next 2018-07-24 23:49:47 -07:00
swift-ci
e9cb62d476 Merge pull request #17987 from brentdax/youll-get-no-argument 2018-07-24 23:39:05 -07:00
Rintaro Ishizaki
2babbc3a44 [CodeComplete] Handle ternary expression in sequence completion
Follow-up to f577578a6a. The same
treatment for ternary expression (IfExpr). Plus, fix a regression
introduced in f577578a where infix operators were disappeard from
results.
2018-07-25 13:59:20 +09:00
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