Commit Graph

3942 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
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
Joe Groff
77dd9b2992 Split exact-subclass and bindable-to-subclass queries.
In many places, we're interested in whether a type with archetypes *might be* a superclass of another type with the right bindings, particularly in the optimizer. Provide a separate Type::isBindableToSuperclassOf method that performs this check. Use it in the devirtualizer to fix rdar://problem/24993618. Using it might unblock other places where the optimizer is conservative, but we can fix those separately.
2016-03-09 11:14:45 -08:00
Chris Lattner
2aaccee71c Revert "Progress towards nested generic typealiases." apparently broke an LLDB test.
This reverts commit 2896fbb586.
2016-03-09 09:26:27 -08:00
practicalswift
89c7cd3e84 Merge pull request #1593 from practicalswift/double-spaces-ii
[gardening] Fix recently introduced accidental double space
2016-03-09 09:01:46 +01:00
practicalswift
5258486f58 [gardening] Fix recently introduced accidental double space 2016-03-09 09:00:26 +01: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
Chris Lattner
2896fbb586 Progress towards nested generic typealiases. They still don't work, but add a
(failing) testcase and progress towards supporting them.
2016-03-08 23:19:56 -08:00
Chris Lattner
ae919bd447 implement mangling support for typealias archetypes, allowing them to get basic USRs. 2016-03-08 21:18:39 -08:00
Xi Ge
ce12c6dc95 ModulePrinting: Add an option to synthesize unconditional extensions; true by default. 2016-03-08 18:34:38 -08:00
Ben Langmuir
bac7521af7 [SourceKit] Fix crash with cursor info on generic typealias
For now, just skip mangling the name since we know the decl context will
crash the mangler.
2016-03-08 18:03:42 -08:00
Michael Gottesman
bb15808554 Convert some trivial std::count_if invocations on ranges to use the provided range adaptor. 2016-03-08 14:58:13 -08:00
Max Moiseev
1fae0d1325 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-08 12:48:48 -08:00
Xi Ge
c84f667676 [Serialization] Serialize the source order of Decls appearing in their original source file.
We used to think the source order is preserved after de-serialization; however, this seems to be
not the case.
2016-03-08 12:18:10 -08:00
Xi Ge
7a3276738b Re-apply "ModulePrinter: Print decls from the same source file near each other."
This reverts commit 1db83907e3.
2016-03-08 12:18:10 -08:00
Ben Langmuir
c9d665ec98 [ASTPrinter] Print typealias generic parameters 2016-03-08 07:11:38 -08:00
Xi Ge
1db83907e3 Revert "ModulePrinter: Print decls from the same source file near each other."
This reverts commit a5c9072344 for mysterious bot test failure.
2016-03-07 23:33:23 -08:00
Xi Ge
a5c9072344 ModulePrinter: Print decls from the same source file near each other. 2016-03-07 22:51:50 -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
Chris Lattner
fe9fe47b7e Implement support for generic typealiases. 2016-03-07 22:20:16 -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
1e21357c31 [ASTPrinter] Use callPrintStructurePre consistently
I can't find anything that's actually broken here (symptom would be
annotations showing up ahead of newlines), but be consistent about
going through callPrintStructurePre to be safe.
2016-03-07 18:22:47 -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
Ben Langmuir
e752de0d20 [SourceKit] Print and annotate the raw value expression of enum elements
For now, only do this in SourceKit (printQuickHelpDeclaration), but
there are probably other printing modes that should do this.

rdar://problem/24292226
2016-03-07 12:36:47 -08:00
Max Moiseev
7fe6916bf6 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-07 12:10:47 -08:00
Ben Langmuir
bd2f100868 [SourceKit] Add keyword tags to a couple of places I missed in TypeRepr printing 2016-03-07 10:37:03 -08:00
Ben Langmuir
3d424b5e96 [SourceKit] Annotate tuple types and nested function types
Move the type callbacks into the respective type/typerepr printers so
taht we get these callbacks even when we print the type directly, or in
a nested fashion.  Also make the returntype more explicit than just
"inside a function type", since visiting the function type currently
visits the input argument tuple (which is different than e.g. the
function *decl* printing, which walks the parameter list explicitly).

rdar://problem/24292226
2016-03-07 10:13:01 -08:00
Chris Lattner
cef7455aa9 [ASTVerifier] Strength reduce some code, since we know we have an extension (NFC). 2016-03-06 21:18:42 -08:00
Chris Lattner
a58d9949bf [ASTDumper] Print generic parameters for an arbitrary GenericTypeDecl, not
just NominalTypeDecls.  NFC
2016-03-06 21:17:43 -08:00
Xi Ge
40f0c7c1f3 ModulePrinting: Save some copies by passing function pointer. NFC 2016-03-05 12:29:01 -08:00
Xi Ge
ccedc2ab6f ModulePrinter: Make sure synthesized extensions are printed in deterministic order. 2016-03-05 11:17:07 -08:00
Xi Ge
7abd2cc1ab ASTPrinter: make a function static. NFC 2016-03-05 10:52:01 -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
Chris Lattner
868a795566 Introduce a new class between TypeDecl and NominalTypeDecl named GenericTypeDecl.
This factors the DeclContext and generic signature behavior out of NTD, allowing
it to be reused in the future.  NFC.
2016-03-04 23:09:15 -08:00
Ben Langmuir
ca1c7f1a70 [ASTPrinter] Fix a couple of 80-column violations NFC 2016-03-04 16:46:35 -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
practicalswift
5b2800225d [gardening] Fix recently introduced typos
Fixed:
* perfomance → performance
* requirments → requirements
* satisified → satisfied
* template template → template
2016-03-04 11:10:50 +01:00
Ben Langmuir
1ea2d46a04 [SourceKit] Add builtin attribute tags
As promised, tag the whole attribute include all of its 'parameters'.

rdar://problem/24292226
2016-03-03 21:20:14 -08:00
Ben Langmuir
bb152f14f9 [ASTPrinter] Fix decl/structure nested callbacks
For now, just force any pending callbacks before doing the structure
callbacks.  This should be fine, since we are always about to print
*something* that isn't whitespace, so there is no change in location.
2016-03-03 20:54:12 -08:00
Ben Langmuir
ba702b846f [SourceKit] Add tags for attribute names
As a first foray into annotating attribute, add tags around attribute
names. For now, treat any decl-modifiers as keywords. We will also want
to wrap the whole attribute (including any parameters) into tags as
well, but that will require more work in the callback hanlding.

Also factor the attribute printing to handle any special cases early,
which will simplify wrapping attributes in tags, since we can then just
put the whole switch intside the pre/post callbacks.

rdar://problem/24292226
2016-03-03 18:39:21 -08:00
Ben Langmuir
f61a241dfc [ASTPrinter] Rename parameter callback to widen scope NFC
I want to start using this for other things like function types and
attributes, so rename it to reflect the new scope. I'm not really happy
with "PrintStructureKind", etc. but haven't come up with anything
better so far.
2016-03-03 18:39:20 -08:00
Xi Ge
591249f953 Simplify some code. NFC 2016-03-03 18:25:35 -08:00
Xi Ge
8bde763ba2 IDETypeChecking: make parameter consistently pass reference. NFC 2016-03-03 18:02:13 -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
65f0e7eb94 [SourceKit] Add annotation tags for generic type requirements
Each requirement gets tagged. We could also tag the whole where clause
if we need to, but so far it hasn't been interesting.

rdar://problem/24292226
2016-03-03 16:11:07 -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