Commit Graph

27 Commits

Author SHA1 Message Date
Dmitri Gribenko
efaa39ea79 stdlib: add first argument labels and some other changes to conform to API guidelines 2016-02-15 23:47:54 -08:00
Doug Gregor
7d70b704e4 Merge commit '5e11e3f7287427d386636a169c4065c0373931a8' into swift-3-api-guidelines 2016-01-19 23:18:20 -08:00
Xi Ge
ca873a9629 [CodeCompletion] Add null check to prevent assertion violations. rdar://22769393 2016-01-14 15:31:32 -08:00
Chris Lattner
78be05921d Revert a testcase change I made in 7daaa22, which doesn't seem correct. 2015-12-31 20:12:12 -08:00
Chris Lattner
7daaa22d93 Completely reimplement/redesign the AST representation of parameters.
Parameters (to methods, initializers, accessors, subscripts, etc) have always been represented
as Pattern's (of a particular sort), stemming from an early design direction that was abandoned.
Being built on top of patterns leads to patterns being overly complicated (e.g. tuple patterns
have to have varargs and default parameters) and make working on parameter lists complicated
and error prone.  This might have been ok in 2015, but there is no way we can live like this in
2016.

Instead of using Patterns, carve out a new ParameterList and Parameter type to represent all the
parameter specific stuff.  This simplifies many things and allows a lot of simplifications.
Unfortunately, I wasn't able to do this very incrementally, so this is a huge patch.  The good
news is that it erases a ton of code, and the technical debt that went with it.  Ignoring test
suite changes, we have:
   77 files changed, 2359 insertions(+), 3221 deletions(-)

This patch also makes a bunch of wierd things dead, but I'll sweep those out in follow-on
patches.

Fixes <rdar://problem/22846558> No code completions in Foo( when Foo has error type
Fixes <rdar://problem/24026538> Slight regression in generated header, which I filed to go with 3a23d75.

Fixes an overloading bug involving default arguments and curried functions (see the diff to
Constraints/diagnostics.swift, which we now correctly accept).

Fixes cases where problems with parameters would get emitted multiple times, e.g. in the
test/Parse/subscripting.swift testcase.

The source range for ParamDecl now includes its type, which permutes some of the IDE / SourceModel tests
(for the better, I think).

Eliminates the bogus "type annotation missing in pattern" error message when a type isn't
specified for a parameter (see test/decl/func/functions.swift).

This now consistently parenthesizes argument lists in function types, which leads to many diffs in the
SILGen tests among others.

This does break the "sibling indentation" test in SourceKit/CodeFormat/indent-sibling.swift, and
I haven't been able to figure it out.  Given that this is experimental functionality anyway,
I'm just XFAILing the test for now.  i'll look at it separately from this mongo diff.
2015-12-31 19:24:46 -08:00
Dmitri Gribenko
31598d41bf Rename GeneratorType to IteratorProtocol 2015-12-07 17:08:32 -08:00
Xi Ge
578f1370d2 [CodeCompletion] For types with type parameters, their constraint extensions are considered unusable. rdar://23173692 2015-12-04 12:02:45 -08:00
Ben Langmuir
9448df6fae [CodeCompletion] Add initial support for completing infix operators
This allows us to start code-completing infix operators in postfix
expressions.  As a first step, this patch only handles completing
against the immediate LHS (so for example 1 == 1 <here> doesn't suggest
boolean operators yet).

The next step is to feed the leading sequence expression from the parser
in so we can consider how the operator being completed fits into the
whole sequence expression.

For rdar://problem/22460167

Swift SVN r32465
2015-10-06 20:48:03 +00:00
Ben Langmuir
be016aedf3 [CodeCompletion] Don't add empty code completion on invalid init
For now, just avoid adding the completion since that will assert later
when we try to sort. In the future we could actually complete something
useful here, since we can dig out the names of the parameters even if
the type is invalid.

rdar://problem/22834017

Swift SVN r32211
2015-09-24 22:13:13 +00:00
Ben Langmuir
94f6eec8ef [CodeCompletion] Don't try to lookup members of a null type
rdar://problem/22835966

Swift SVN r32207
2015-09-24 20:03:32 +00:00
Ben Langmuir
41c7a28120 [CodeCompletion] Avoid salvaging when code completing expressions
Salvaging can try to apply a solution when producing diagnostics, and we
can't generally apply solutions in code completion because they may
contain free type variables.

rdar://problem/22836263

Swift SVN r32203
2015-09-24 18:49:43 +00:00
Ben Langmuir
3fdfd1a05a [CodeCompletion] Fix assertion failure with curried function
Remove some untested broken code that I am fairly sure could never find
the correct FunctionDecl.

rdar://problem/22688199

Swift SVN r32000
2015-09-16 18:03:32 +00:00
Ben Langmuir
0a43e5460f [CodeComplete] Don't try to lookup members of null type
rdar://problem/22012123

Swift SVN r31639
2015-09-02 21:16:48 +00:00
Xi Ge
a587c3be53 Check if an extended type is null before further look up. rdar://22036358
Swift SVN r31012
2015-08-04 22:10:04 +00:00
Xi Ge
87018e516f [CodeCompletion] No crashing when function name is empty. rdar://21149908
Swift SVN r31011
2015-08-04 22:09:58 +00:00
Xi Ge
85367420bd [CodeCompletion] Adjust archetype depth so that mangler is always consistent with type checker. rdar://21435993
Swift SVN r30709
2015-07-28 00:02:44 +00:00
Xi Ge
11600e1543 [CodeCompletion] Add checks for erroneous extended types to prevent crash. rdar://21436558
Swift SVN r30708
2015-07-28 00:02:41 +00:00
Xi Ge
4dcc3f1469 [CodeCompletion] No crash on a terribly wrong code completion position. rdar://21796881
Swift SVN r30706
2015-07-28 00:02:33 +00:00
Jordan Rose
27b8451feb Ensure that generic parameters always have a valid access level.
...just in case they end up in a situation where we want to check their
access level. Like code completion.

rdar://problem/21197042

Swift SVN r29453
2015-06-17 18:04:40 +00:00
Denis Vnukov
a2be912e49 Minor: moved code completion test
Swift SVN r25142
2015-02-10 23:35:11 +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
Doug Gregor
b642c555be Allow one to change the argument labels of curried function parameters.
Curried function parameters (i.e., those past the first written
parameter list) default to having argument labels (which they always
have), but any attempt to change or remove the argument labels would
fail. Use the fact that we keep both the argument labels and the
parameter names in patterns to generalize our handling of argument
labels to address this problem.

The IDE changes are due to some positive fallout from this change: we
were using the body parameters as labels in code completions for
subscript operations, which was annoying and wrong.

Fixes rdar://problem/17237268.

Swift SVN r24525
2015-01-19 22:15:14 +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
Argyrios Kyrtzidis
26376f0854 [IDE] Fix crash when code-completing inside an erroneous computer let variable.
rdar://17695497

Swift SVN r20211
2014-07-19 17:58:18 +00:00
Dmitri Hrybenko
31f0b0a145 Code completion: fix crash when a closure is called in place
rdar://17164209


Swift SVN r20152
2014-07-18 11:58:57 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dmitri Hrybenko
04a5bcf687 Add a test case that I missed in r14271.
Swift SVN r14298
2014-02-24 11:57:50 +00:00