Commit Graph

322 Commits

Author SHA1 Message Date
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
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
c85591bc25 [SourceKit] CursorInfo: not showing @warn_unused_result in quick help. 2016-03-18 16:39:27 -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
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
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
5168083bf3 ModulePrinting: Print new lines between members of a decl. 2016-03-11 12:26:04 -08:00
Xi Ge
13e7e1f7be ModulePrinting: Not showing @warn_unused_result in the printed module interface. 2016-03-10 17:56:35 -08:00
Xi Ge
c22e9bcf53 ModulePrinting: Merge synthesized extensions' bodies if they have the common constraints. 2016-03-10 17:50:24 -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
Xi Ge
ce12c6dc95 ModulePrinting: Add an option to synthesize unconditional extensions; true by default. 2016-03-08 18:34:38 -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
Xi Ge
40f0c7c1f3 ModulePrinting: Save some copies by passing function pointer. NFC 2016-03-05 12:29:01 -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
Xi Ge
591249f953 Simplify some code. NFC 2016-03-03 18:25: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
Xi Ge
bafe60e91b Refactoring: move IsInSynthesizedExtension to Analyzer. NFC. 2016-03-02 17:30:11 -08:00
Xi Ge
3f20eb242d Refactoring: Moving the logic of collecting synthesized extensions to Analyzer. NFC. 2016-03-02 17:30:11 -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
Andrew Trick
ff02652108 Move enums into AttrKind.h.
This reorganization allows adding attributes that refer to types.
I need this for a @_specialize attribute with a type list.

PrintOptions.h and other headers depend on these enums. But Attr.h
defines a lot of classes that almost never need to be included.
2016-02-26 21:10:22 -08:00
Ben Langmuir
dbd32f31b9 [SourceKit] Add cursor/doc info for enum elements
Similarly to pattern binding decls, we want to be able to explode a case
decl out into a synthesized enum case for each individual enum element.
2016-02-26 16:28:13 -08:00
Doug Gregor
1c2ce6f22f [Omit needless words] Add a flag to let us skip overrides and witnesses.
When performing Swift API dumps, it's helpful to avoid putting
redundant APIs into the results. Therefore, filter out any APIs that
are overrides of another API or are witnesses for a protocol
requirement, since the original definition (that doesn't override any
other or is a protocol requirement) is what determines the APIs name.
2016-02-24 17:47:31 -08:00
practicalswift
6eefb5f8db [gardening] Fix recently introduced typo: "inteface" → "interface" 2016-02-19 14:19:56 +01:00
Xi Ge
17cde5322f [gardening] ASTPrinter: encapsulate archetype-transformation related stuff into a sub-structure. NFC 2016-02-17 15:35:28 -08:00
Xi Ge
d4f704bb2f ASTPrinter: Add pre and post callbacks for printing synthesized extensions and call them.
This is necessary for jump to synthesized extensions in IDE.
2016-02-15 17:41:49 -08:00
Xi Ge
6837c17c17 [SourceKit][CursorInfo] Replace archetypes in cursor info results to actual types. rdar://24494225 2016-02-03 17:14:13 -08:00
Xi Ge
ae60159816 [ModulePrint] Add the initial implementation for printing synthesized extensions.
For a concrete type, members from its conforming protocols' extensions can be hard
to manually surface. In this commit, when printing Swift modules, we start to replicate these
extensions and synthesize them as if they are the concrete type's native extensions.

Credit to Doug for suggesting this practice.
2016-02-02 14:53:21 -08:00
Alex Hoppen
722193a5f9 [CodeCompletion] Fix SR-627 Code Completion does not resolve generics that have been assigned a concrete type 2016-02-02 12:34:35 +01:00
Doug Gregor
67c81154af Add a swift3_migration attribute to describe how an API gets migrated.
Introduce a new attribute, swift3_migration, that lets us describe the
transformation required to map a Swift 2.x API into its Swift 3
equivalent. The only transformation understood now is "renamed" (to
some other declaration name), but there's a message field where we can
record information about other changes. The attribute can grow
somewhat (e.g., to represent parameter reordering) as we need it.

Right now, we do nothing but store and validate this attribute.
2016-01-13 16:53:01 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
22e10737e2 Fix typos 2015-12-26 01:19:40 +01:00
Argyrios Kyrtzidis
8659022917 [ASTPrint] For when printing interface from a source file, introduce an option to
pick up the original source text for the declarations.
2015-12-02 23:51:49 -08:00
Argyrios Kyrtzidis
04e3949985 [ASTPrint] Introduce a printing option to hide underscored protocols in the stdlib. 2015-12-02 22:38:34 -08:00
Slava Pestov
d432286980 Re-apply "Sema: Targeted fix for LLDB REPL issue"
Now with a change to the AST printer to never print @_fixed_layout.
Once some more groundwork is in place, we will be able to only print
this attribute when its needed, but this is good enough for now.
2015-11-20 20:01:46 -08:00
Xi Ge
9beeb56a90 [TypeInterface] When printing type-specific interfaces, replace parameter and return types with instantiated types. 2015-11-17 19:12:30 -08:00
Xi Ge
01ec4f2ebd [TypeInterface] Replace generic params with instantiated type when printing type-specific interface. 2015-11-17 19:12:30 -08:00
Joe Groff
fbd2e4d872 Rename @asmname to @_silgen_name.
This reflects the fact that the attribute's only for compiler-internal use, and isn't really equivalent to C's asm attribute, since it doesn't change the calling convention to be C-compatible.
2015-11-17 14:13:48 -08:00
Doug Gregor
9491ec4c02 Add a swift-ide-test option to not print import declarations.
The import declarations get in the way when looking the results of
-enable-omit-needless-words.
2015-11-16 15:27:38 -08:00
Ben Langmuir
889b033964 [CodeCompletion] Add completion for property overrides
This mostly works the same as for functions. It required a slight tweak
to how we handle 'var <complete>' to avoid consuming the code completion
token prematurely.

rdar://problem/21012767

Swift SVN r32844
2015-10-23 05:38:07 +00:00
Xi Ge
5ca83d97a5 [InterfacePrint] Enhance ASTPrinter to support type-specific interface printing.
When users try to print the interface of a specific type (most often through cursor
infor query of SourceKit), we should simplify the original decls by replacing
archetypes with instantiated types, hiding extension details, and omitting
unfulfilled extension requirements. So the users can get the straight-to-the-point
"type interface". This commit builds the testing infrastructure for this feature,
and implements the first trick that wraps extension contents into the interface body.

This commit also moves some generic testing support from SourceKit to Swift.

Swift SVN r32630
2015-10-12 19:14:58 +00:00
Argyrios Kyrtzidis
034ec91f1a [AST/PrintOptions] Refactor PrintOptions::printInterface(bool) and introduce separate printForDiagnostics() function.
This makes the use case clear both for the caller and when adding new options on where they should be enabled or not.

Swift SVN r32152
2015-09-22 17:54:21 +00:00
Doug Gregor
44b8d45288 Clean up inference of default arguments from imported APIs (mostly).
My temporary hackery around inferring default arguments from imported
APIs was too horrible. Make it slightly more sane by:

1) Actually marking these as default arguments in the type system,
rather than doing everything outside of the type system. This is a
step closer to what we would really do, if we go in this
direction. Put it behind the new -frontend flag
-enable-infer-default-arguments.

2) Only inferring a default argument from option sets and from
explicitly "nullable" parameters, as stated in the (Objective-)C API
or API notes. This eliminates a pile of spurious, non-sensical "=
nil"'s in the resulting output.

Note that there is one ugly tweak to the overloading rules to prefer
declarations with fewer defaulted arguments. This is a bad
implementation of what is probably a reasonable rule (prefer to bind
fewer default arguments), which intentionally only kicks in when we're
dealing with imported APIs that have default arguments.

Swift SVN r32078
2015-09-18 21:50:59 +00:00
Xi Ge
f63ab9f6f1 [ASTPrint] Still print extended types even though they err.
Swift SVN r32044
2015-09-17 20:48:07 +00:00
Xi Ge
cc3c73afff [ASTPrint] Add an option to avoid printing unresolved extension decls. rdar://22676315
Swift SVN r31983
2015-09-16 01:13:57 +00:00
Doug Gregor
dc820315ba Omit needless words: fake defaulted imported optional and option-set arguments.
Introduce a hack that allows us to fake importing optional and
option-set parameters as "nil" or "[]", respectively.

Swift SVN r31977
2015-09-15 22:45:47 +00:00
Xi Ge
efb19787a1 [InterfaceGen] Not printing '@rethrows' since we print 'rethrows'. rdar://22449614
Swift SVN r31538
2015-08-27 18:47:41 +00:00
Chris Lattner
be818c6193 Adjust how diagnostics synthesize decls (e.g.) when printing overload sets,
to print them with their interface representation.  This squelches attributes
like @_inline and @semantics.


Swift SVN r31462
2015-08-25 23:52:53 +00:00