Commit Graph

1154 Commits

Author SHA1 Message Date
Max Moiseev
885b564bf5 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 17:16:37 -08:00
Xi Ge
d81edcb6b6 ModulePrinting: Properly substitute via metatype to simplify complex bound generic types appearing in synthesized extensions. rdar://25063840 2016-03-09 17:09:34 -08:00
Ben Langmuir
4a30637e08 [CodeCompletion] Don't complete unavailable methods in override
We generally don't want to override unavailable methods.  We already
filter out unavailable decls when completing values, but that's in a
separate visible decl consumer.

rdar://problem/25058233
2016-03-09 16:20:23 -08:00
Max Moiseev
02006f20bc Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-09 16:05:03 -08:00
Ben Langmuir
19d13c3aee Reapply "[CodeCompletion] Don't show the loop index before it is visible"
With the tests updated to account for not having the correct behaviour
for brace-stmt items from after the code-completion point.  That part
turns out to be harder to fix.

This reverts commit a5325e6281.
2016-03-09 14:02:51 -08:00
Argyrios Kyrtzidis
c939234d1f [test] Modify the test so that it can pass on linux as well. 2016-03-08 23:59:13 -08:00
Argyrios Kyrtzidis
345d05e2e9 Introduce an internal attribute '@_show_in_interface' to be used in stdlib for underscored protocols that
should be shown in the interface.

Also switch the option and hide all underscored protocols by default, unless they are marked with the new attribute.
2016-03-08 23:30:58 -08:00
Ben Langmuir
a39ab90c59 [IDE] Ensure we don't miss unreconstructed types in test NFC
Just a sanity check so we don't miss something accidentally; we can
always disable this late if it becomes a burden.
2016-03-08 20:40:17 -08:00
Ben Langmuir
d59a57339e [CodeCompletion] Add some basic sanity tests for generic typealiases
Basically check that the name of the type shows up as a result, and that
we can look through to the members of the underlying type.
2016-03-08 20:13:16 -08:00
Max Moiseev
1fae0d1325 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-08 12:48:48 -08:00
Ben Langmuir
ce3c2de4a6 [CodeCompletion] Convert optionals when checking for literal protocol conformance
Except for nil literals, we don't want to look at the optional itself,
since the typechecker would implicitly look to the underlying type.

rdar://problem/24707210
2016-03-08 09:39:04 -08:00
Ben Langmuir
c9d665ec98 [ASTPrinter] Print typealias generic parameters 2016-03-08 07:11:38 -08:00
Ben Langmuir
739c409140 Revert "[CodeCompletion] Don't show variables defined after the completion loc"
This broke some tests; may need a different approach.

This reverts commit 9734bd94bb.
2016-03-07 22:29:24 -08:00
Ben Langmuir
a5325e6281 Revert "[CodeCompletion] Don't show the loop index before it is visible"
This reverts commit ce77c868d1.
2016-03-07 22:29:00 -08:00
Ben Langmuir
09754f21cd [CodeCompletion] Don't add type-relation for SequenceType protocol in loop
We don't want to prioritize the type name for protocols, since they
can't be used (generally) to construct an instance of the type. Ideally
we would prioritize types that conform to the protocol.

For rdar://problem/24873625
2016-03-07 22:22:18 -08:00
Ben Langmuir
ce77c868d1 [CodeCompletion] Don't show the loop index before it is visible
for i in <here>            // should *not* show 'i'
for i in ...  where <here> // should show 'i'
for i in ... { <here>      // should show 'i'

Part of rdar://problem/24873625
2016-03-07 22:04:49 -08:00
Ben Langmuir
9734bd94bb [CodeCompletion] Don't show variables defined after the completion loc
... in brace statements. Found by inspection.
2016-03-07 22:01:01 -08:00
Ben Langmuir
d12a2d7df2 [CodeCompletion] Fix completion in top-level 'is' and 'as' expressions
We forgot to return a code-completion status, so we didn't get to it in
the second phase.

"a" as <here>

rdar://problem/24376361
2016-03-07 21:16:26 -08:00
Ben Langmuir
54963be34d [CodeCompletion] Fix completion of collection type in top-level code
We forgot to return a code-completion status, so we didn't get to it in
the second phase.

let foo: [<here>]

rdar://problem/24441902
2016-03-07 21:02:25 -08:00
Xi Ge
7e3e42c272 ModulePrinting: Teach synthesized extension analyzer to handle bounded generic types appearing in requirements. 2016-03-07 13:27:54 -08:00
Max Moiseev
7fe6916bf6 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-07 12:10:47 -08:00
Xi Ge
7c90d2c83f ModuelPrint: when printing synthesized extensions, print the full name of the extended type. 2016-03-05 10:47:12 -08:00
Ben Langmuir
5c29920acd [ASTPrinter] Simplify callbacks by dropping the notion of 'pending' callbacks
The three varieties of 'pending callbacks' made it hard to reason about
how callbacks would be presented to subclasses of ASTPrinter.  I
recently added new callbacks that would have made this even more complex
to deal with.

Luckily, it turns out they weren't buying us much, and simply forcing
any pending newlines and indentation to be printed ahead of making
callbacks was almost identical to the old behaviour. One complication is
that we now need to check for clang doc comments up front so we will
emit a newline in the right place.

This also incidentally fixed a bug in Loc vs Decl callback order.
2016-03-04 16:26:35 -08:00
Xi Ge
326514e397 ModulePrinting: when printing synthesized extensions, avoid printing requirements that are known to be true. 2016-03-03 17:42:35 -08:00
Ben Langmuir
ceb1069199 Prefer original spelling of 'static' vs. 'class'
Try to match the original spelling of static/class in diagnostics and
when printing the AST. Also fixes cases with
PrintOptions.PrintImplicitAttrs = false, where we would just print
'class', which was not valid code.
2016-03-03 13:48:30 -08:00
Max Moiseev
cf4bafe9e3 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-03 13:22:03 -08:00
David Farler
e958f99acf Revert "Mangle declared interface type into NominalTypeDescriptor's Name"
This reverts commit 2262bd579a.

This information isn't necessary for field descriptor lookup,
after all. It's only the fields that need to have generic information,
which is already in the field descriptor.
2016-03-03 12:55:35 -08:00
David Farler
2262bd579a Mangle declared interface type into NominalTypeDescriptor's Name
Previously, the mangling didn't include generics, but these are
needed to key off of the new field descriptor metadata, as well
as to construct type references for the nominal type.
2016-03-03 12:14:38 -08:00
Ben Langmuir
8f9299cc97 [CodeCompletion] Add assignment to experimental operator completion
When the LHS is an lvalue/assignable tuple and there is no leading
sequence of binary expressions.

It's a bit hacky right now since we don't have a good way to
differentiate general pattern completions from builtin operators.

rdar://problem/23209683
2016-03-02 18:21:37 -08:00
Xi Ge
65a3aade7e [SourceKit] Cursor info: for extension decls, the cursor info query always returns the extended nominal's group name. 2016-03-02 17:30:11 -08:00
Ben Langmuir
d12f1f0665 [ASTPrinter] Funnel keyword printing through a common interface NFC
Start threading all keyword (and contextual keyword) printing through
printName, and add a new PrintNameContext for keywords.  For now we just
pass this through without changing behaviour.

Also add an operator<< for printing from the tok:: kind for keywords,
which makes it much more convenient for performing the required
callbacks.

rdar://problem/24292226
2016-03-02 16:46:25 -08:00
Greg Titus
de8deb0868 Merge pull request #1481 from gregomni/switch-cases
Improve var decl completion in switch cases
2016-03-02 14:03:26 -08:00
Xi Ge
cf7d483304 ModulePrinting: Avoid hard-coding unsatisfiable type requirements, query constraint solver for answers.
Thank Doug and Joe P for suggesting this!
2016-03-02 12:28:02 -08:00
Xi Ge
906d6f1f8c [Test] Avoid running playground coloring test on Linux. 2016-03-01 16:18:11 -08:00
Xi Ge
9c2f28475e [SyntaxColoring] Highlight doc comment keywords in playground-specific doc comment format. rdar://24870642 2016-03-01 15:44:41 -08:00
Xi Ge
60be59953a ModulePrinting: Add the basic infrastructure to remove inapplicable synthesized extensions.
As the initial step, we remove any synthesized extensions requiring a tuple's conforming to nominals, which
never happens. This will remove multiple useless synthesized extensions for Dictionary.
2016-03-01 15:44:41 -08:00
Doug Gregor
3ffbe020d7 [Clang importer] Handle name mapping for "getter:" and "setter:" in swift_name.
The swift_name string format now supports "getter:" and "setter:"
prefixes to indicate that a function is the getter or setter of a
Swift-synthesized property. Start parsing these DeclNames and make
sure they're reflected in the Swift name lookup tables.

[Clang update required]
2016-03-01 15:33:21 -08:00
Doug Gregor
7265328e07 [Clang importer] Generalize name lookup tables for globals-as-members.
A swift_name attribute on a global declaration can specify a dotted
name (e.g., SomeStruct.member) to map that global into a member of the
(Swift-)named type. Handle this mapping in DeclName parsing, plumb it
through importFullName, and cope with it in the Swift name lookup
tables (tested via the dump) and importing into a Swift DeclContext
(as-yet-untested). Part of SE-0033.
2016-03-01 15:33:20 -08:00
Max Moiseev
859db53d87 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-01 12:56:26 -08:00
Doug Gregor
87f1d577a3 [Omit needless words] Retain "with" after splitting more regularly.
The verb-based heuristic was unpredictable and not clearly
better. Back off to something more obvious.
2016-02-29 13:14:24 -08:00
Doug Gregor
b890e4c29f [Omit needless words] Use the property lists to restrict BaseNameSelf pruning.
This eliminates some apparent inconsistencies in the translation,
fixing rdar://problem/24860176.
2016-02-29 13:14:23 -08:00
Max Moiseev
e48f452a2e Merge remote-tracking branch 'origin/swift-3-api-guidelines' into swift-3-api-guidelines 2016-02-29 12:15:33 -08:00
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Xi Ge
fbd74a317d [Test] Add a test to make sure every group has decls to print. 2016-02-29 12:03:50 -08:00
gregomni
30b67344b2 Improve var decl completion in switch cases
Variables bound in the case item pattern should be available inside the
case body and in the where clause, but not elsewhere within the
statement (e.g. other case items). The added accessor
CaseStmt.getLabelItemsRange() is needed to be able to determine the
difference between a completion location after a colon and one where
the colon doesn’t exist (in both cases this would be in the — implicit
— body statement range).
2016-02-28 22:17:29 -08:00
Daniel Duan
2bc78b8c09 [stdlib] update for 'inout' adjustment (SE-0031) 2016-02-26 12:02:29 -08:00
Chris Lattner
dfaaebc0a0 Merge pull request #1333 from dduan/SE-0031
[SE-0031] Adjusting 'inout' Declarations for Type Decoration
2016-02-26 10:41:58 -08:00
Daniel Duan
780b58a9a5 [Parser] update tests for 'inout' syntax adjustment 2016-02-26 01:33:22 -08:00
Jordan Rose
b319e3da32 stdlib: Adjust to insert(contentsOf:at:) and append(contentsOf:)
instead of insertContents(of:at:) and appendContents(of:),
originally insertContentsOf(_:at:) and appendContentsOf(_:)
per internal discussion.
2016-02-25 12:50:39 -08:00
Ben Langmuir
c07791880b [ASTPrinter] Use TypeLoc printing for subscript element type
Printing as a TypeRepr gives better results.
2016-02-25 12:50:05 -08:00