Commit Graph

29 Commits

Author SHA1 Message Date
Rintaro Ishizaki
71aeffdf17 [CodeCompletion] Calculate type relation for EnumElementDecl 2020-02-03 17:20:50 -08:00
Nathan Hawes
feb48a61b9 [code-completion] Fix correctness regressions from disabling diagnostics in code completion
There were some changes to completion results because AST mutations that were
made while diagnosing are no longer happening.

This patch 1) changes expression type checking to allow unresolved types when
solving constraint systems, so we get a solution and apply its types in more
cases, and 2) fixes a parsing issue where we would drop a ternary expression
completely if the code completion point was in its true branch.
2019-08-30 15:26:27 -07:00
Nathan Hawes
746340f9d9 [code-completion] Don't delay parsing a decl within a closure - delay the decl containing that closure instead
We were losing the CurLocalContext state (set when entering the closure's
BraceStmt) through the delaying process, sometimes causing errors when we
got back to parsing a delayed decl.

Resolves rdar://problem/54219186
2019-08-28 14:44:25 -07:00
Ben Langmuir
f5a216fc04 Merge pull request #23411 from benlangmuir/cc-1-close
[code-completion] Add type context for single-expression closures
2019-03-20 06:56:49 -07:00
Ben Langmuir
b817cbb9bc [code-completion] Add type context for single-expression closures
When completing in the only expression of closure, use the return type
of the closure as the type context for the code-completion. However,
since code-completion may be on an incomplete input, we only use the
return type to improve the quality of the result, not to mark it
invalid, since (a) we may add another statement afterwards, or (b) if
the context type is Void it doesn't need to match the value.
2019-03-18 17:04:33 -07:00
Rintaro Ishizaki
3e4ab1fd31 [CodeCompletion] Add already fixed test case
rdar://problem/36818556
2019-03-18 12:31:54 -07:00
Rintaro Ishizaki
797761adae [CodeCompletion] Try to parse complete expression after CC token
Type may depend on its suffix. Parsing complete expression including its
suffix improves context type info around the CC token.

rdar://problem/44143964
2018-10-16 06:08:29 +09:00
fischertony
7b41a41fb6 updated tests & added completions for postfixExpr 2018-05-12 09:05:57 +03:00
Pavel Yaskevich
1ee03bc9c4 [TypeChecker] Miscellaneous changes to switch to FunctionType::getParams() 2018-04-26 17:33:08 -07:00
practicalswift
ef8e43b519 [gardening] Increase consistency with regards to spacing after colons 2016-09-22 16:28:57 +02:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
ken0nek
3ac60b13f5 Add spaces before and after closure arrow in test 2015-12-23 04:38:46 +09:00
Xi Ge
c8ab2b6999 Re-apply "[CodeComplete] Make sure the lookup API can find closure parameters. rdar://17968255"
This also fixes an ASAN issue when TuplePattern tries to retrieve its associated element buffer whose
size is 0.

Swift SVN r32303
2015-09-29 19:14:06 +00:00
Xi Ge
586ccaefbd Revert "Re-apply "[CodeComplete] Make sure the lookup API can find closure parameters. rdar://17968255""
for unhappy bot.

Swift SVN r32258
2015-09-26 06:33:45 +00:00
Xi Ge
c22ab44013 Re-apply "[CodeComplete] Make sure the lookup API can find closure parameters. rdar://17968255"
Swift SVN r32257
2015-09-26 05:54:43 +00:00
Xi Ge
82fd4009c2 Revert "[CodeComplete] Make sure the lookup API can find closure parameters. rdar://17968255"
for breaking build bot.

Swift SVN r32255
2015-09-26 00:58:46 +00:00
Xi Ge
3e925ca930 [CodeComplete] Make sure the lookup API can find closure parameters. rdar://17968255
Swift SVN r32252
2015-09-25 23:48:50 +00:00
Ben Langmuir
6df189b6f4 [CodeCompletion] Restore scope depth in delayed parsing
When the scope depth is wrong and we add a name to the hash table we
will skip the redefinition checks and end up hitting an assertion
failure.

rdar://problem/22344218

Swift SVN r31690
2015-09-04 18:29:45 +00:00
Ben Langmuir
a33ac57234 [CodeCompletion] Loosen an assert that's firing in closure bodies
Taking an ErrorType should be fine if we can't do any better.

rdar://problem/20923711

Swift SVN r29013
2015-05-25 20:30:59 +00:00
Denis Vnukov
152df92966 [CodeCompletion] Code Completion String getName should always return non-empty string value for
valid code completions. Code completion tests call and validate getName’s result. 

A minor fix for code completion fro subscripts.



Swift SVN r25101
2015-02-09 22:32:05 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Chris Lattner
440e38f66f fix <rdar://problem/19135222> swift reserves 'new' keyword and doesn't use it
by removing the old fixit code for migrating code away from the obsolete 'new' syntax
for allocating arrays.



Swift SVN r23664
2014-12-03 23:16:45 +00:00
Argyrios Kyrtzidis
d37855e5c5 [IDE] Fix crash when code-completing inside a closure initializer of a member.
rdar://18246941

Swift SVN r21809
2014-09-09 19:29:19 +00:00
Dmitri Hrybenko
b0c3a56c96 Code completion: fix some type checking issues of closures
Completely disable the AST transformation for single-expression closures.  When
this transformation picks up an incomplete expression, the resulting AST is
almost guaranteed to have type mismatches, and the type checker just marks
everything with error types.

rdar://17193319 rdar://17086137


Swift SVN r20153
2014-07-18 14:49:34 +00:00
Dmitri Hrybenko
8234c70f88 Code completion: fix delayed parsing of closures
The delayed parsing was in place, but the expressions were being thrown away by
"recovery" in the parser.

rdar://16274593


Swift SVN r20151
2014-07-18 11:43:38 +00:00
Ben Langmuir
5223a6342e Add another xfail'd test for code-completion in property closures
Lazy properties can be weird, so give them their own closure completion
test.

Swift SVN r20093
2014-07-17 16:08:28 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dmitri Hrybenko
724a93885c Code completion tests: move tests for completion inside closures into a
separate file


Swift SVN r7891
2013-09-04 02:03:35 +00:00