Chris Lattner
a0c5d2a7df
adjust autoclosure/noescape printing to print them in their type
...
position instead of before a parameter. This wraps up the meat of
SE-0049.
2016-04-15 17:04:12 -07:00
Chris Lattner
ab14e6706f
Progress towards implementing SE-0049 - Allow autoclosure in parameter types
...
as well as on parameter decls. Also, tighten up the type checker to look at
parameter types instead of decl attributes in some cases (exposing a type
checker bug).
Still TODO:
- Reject autoclosure/noescape on non-parameter types.
- Move stdlib and other code to use noescape and autoclosure in the right
spot.
- Warn about autoclosure/noescape on parameters decls, with a fixit to move it.
- Upgrade the warning to an error.
2016-04-14 23:13:43 -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
practicalswift
abfecfde17
[gardening] if ([space]…[space]) → if (…), for(…) → for (…), while(…) → while (…), [[space]x, y[space]] → [x, y]
2016-04-04 16:22:11 +02:00
Ge Sen
5ad36b2962
[gardening] Put white spaces in between if/while clauses and braces where it is missing.
...
For instance:
'if (foo){' => 'if (foo) {'
2016-04-02 14:43:45 +08:00
Xi Ge
61248dec24
[SourceKit] DocInfo: Fixing a paired-callback mismatch issue when merging nominals with extensions. rdar://25431244
2016-03-31 12:43:34 -07:00
Xi Ge
c10a818d12
ModulePrinting: Avoid merging protocol extensions' contents with protocol's bodies.
2016-03-30 14:26:17 -07:00
Xi Ge
e8eba770d5
Mark a recently added function as static, NFC.
2016-03-23 15:25:03 -07:00
Xi Ge
b4d0cb4ffe
ModulePrinting: Avoid printing duplicated members in synthesized extensions.
2016-03-23 15:19:16 -07:00
Doug Gregor
593932741c
Remove historical flags -enable-omit-needless-words/-enable-infer-default-arguments/-enable-swift-name-lookup-tables.
...
NFC; all of these options are always-on now and we no longer have a
way to turn them off.
2016-03-22 17:04:19 -07:00
Xi Ge
33c53a12eb
ASTPrinter: Pass the bracket options to pre and post printing callbacks.
...
Need this for rdar://24912860
2016-03-22 14:49:22 -07:00
Doug Gregor
1d87524c67
[swift-ide-test] Make -skip-overrides more aggressive in its pruning.
...
Cope with imported protocol members as well, which pares down the size
of Swift API projections considerably. Fixes rdar://problem/25223995.
2016-03-22 11:01:40 -07:00
Ben Langmuir
187bc9fbb9
[CursorInfo] Annotate tuple types in fully annotated decl
...
We already annotate the elements, this just adds annotations around the
outer parentheses, including when the tuple is unit.
rdar://problem/25147925
2016-03-21 16:31:52 -07:00
Xi Ge
66fb8062fe
ModulePrinting: For decls without doc-comment, we print the doc-comment associated with their conformances, if any.
...
Inspired by rdar://24409720
2016-03-21 14:35:32 -07:00
practicalswift
a0d494c143
[gardening] Fix recently introduced typos: "fucntion" → "function", "functio" → "function", "mergable" → "mergeable", "mistmatched" → "mismatched"
2016-03-20 10:34:32 +01:00
Xi Ge
4c49e67780
ModulePrinting: Sort the extensions inside a merge group so that actual extensions get printed before synthesized ones.
2016-03-18 11:29:43 -07:00
Xi Ge
c6fce1dd17
ModulePrinting: For protocols, exclude synthesized extension from conforming protocols, just print the native ones.
2016-03-17 23:31:29 -07:00
Xi Ge
6665c4850b
ModulePrinting: Synthesize extensions for protocols as well.
2016-03-17 21:59:25 -07:00
Xi Ge
a99a3556e7
ModulePrinting: Encapsulate bracket options into a sub-structure of PrintOptions. NFC
2016-03-17 21:34:51 -07:00
Xi Ge
43d2cd2908
ModulePrinting: Sort extension merge groups before printing them; so that constraint-free extensions get printed first.
2016-03-17 17:54:50 -07:00
Xi Ge
d8a7118966
ModulePrinting: Rename merge group kinds.
2016-03-17 17:54:50 -07:00
Xi Ge
b894798e46
ModulePrinting: For those extensions have no doc-comments, no constraints and no inheritance, we merge their contents to the body of the type declaration.
2016-03-17 16:26:34 -07:00
Xi Ge
3dbd14be00
ModulePrinting: Refactoring SynthesizedExtensionAnalyzer to better expose the merge groups of extensions. NFC
2016-03-17 16:26:34 -07:00
Xi Ge
10fefc532f
gardening: simplify an unnecessary unique pointer usage.
2016-03-16 17:29:37 -07:00
Xi Ge
c3de0db612
ModulePrinting: Merge the content of extensions of the same constraints/inherits, disregarding of whether they are synthesized or actual.
2016-03-16 17:29:37 -07:00
Xi Ge
4bc02d61da
ModulePrinting: Avoid merging synthesized extensions with comments, and print the comments. rdar://25157796
2016-03-15 13:35:14 -07:00
Ben Langmuir
11c8f07cc9
[SourceKit] Annotate dynamic Self type in protocol *extensions*
...
D'oh, forgot to resolve a FIXME in my protocol commit. Now working there
too except that it's giving USRs on the original protocol instead of the
extension. It's not clear how to get back to the extension from the
archetype though.
rdar://problem/25128561
2016-03-14 21:34:08 -07:00
Ben Langmuir
1b08d83b6f
[SourceKit] Annotate class method dynamic Self return types
...
Pass through the original Type in addition to the TypeDecl so that we
can distinguish DynamicSelfType with underlying ClassType from just any
old ClassType.
rdar://problem/25158493
2016-03-14 19:43:54 -07:00
Ben Langmuir
ca198b0320
[SourceKit] Annotate dynamic Self type in protocols
...
Treat it like the static Self type, which is good enough for producing
USRs in CursorInfo. This doesn't handle class dynamic self, which needs
some kind of API change to printTypeRef to make it work.
rdar://problem/25128561
2016-03-14 18:17:55 -07:00
Xi Ge
5a5e655f73
ModulePrinting: Removing the comments that indicate an extension is synthesized; we will make the difference clear by using different syntax colors.
2016-03-14 13:13:37 -07:00
Ben Langmuir
f899413f1d
[SourceKit] Annotate default argument keywords #file/#line/...
...
rdar://problem/25128866
2016-03-13 12:26:10 -07:00
Ben Langmuir
0e8978aaf0
[SourceKit] Annotate parameter noescape/autoclosure attributes
...
rdar://problem/25128165
2016-03-13 12:26:09 -07:00
Xi Ge
5168083bf3
ModulePrinting: Print new lines between members of a decl.
2016-03-11 12:26:04 -08:00
Xi Ge
4c4ce88330
ModulePrinting: Shorten the indicator of synthesized extensions.
2016-03-11 12:26:03 -08:00
Xi Ge
c22e9bcf53
ModulePrinting: Merge synthesized extensions' bodies if they have the common constraints.
2016-03-10 17:50:24 -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
Xi Ge
ce12c6dc95
ModulePrinting: Add an option to synthesize unconditional extensions; true by default.
2016-03-08 18:34:38 -08:00
Ben Langmuir
c9d665ec98
[ASTPrinter] Print typealias generic parameters
2016-03-08 07:11:38 -08:00
Chris Lattner
fe9fe47b7e
Implement support for generic typealiases.
2016-03-07 22:20:16 -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
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
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