Commit Graph

672 Commits

Author SHA1 Message Date
Doug Gregor
23549296ed [swift-ide-test / swift-api-dump.py] Add -iframework support. 2016-10-13 14:43:39 -07:00
Brian Gesiak
c568d400ed [swift-ide-test] Fix typo: s/completin/completion/ 2016-10-13 11:44:14 -07:00
Doug Gregor
c91064ba8e [Clang importer] Pass Swift major version to Clang's API notes.
Clang now accepts an option -fapinotes-swift-version=XX that describes
which Swift version to use when applying API notes to the Clang
AST. Pass this option down to Clang based on the Swift major version
number (e.g., 3 or 4), allowing API notes to introduce
Swift-version-specific behavior.

Fixes rdar://problem/28617631.
2016-10-04 14:23:03 -07:00
Slava Pestov
cfe9e6a3de IDE: Use GenericSignatures and interface types (mostly)
There was a ton of complicated logic here to work around
two problems:

- Same-type constraints were not represented properly in
  RequirementReprs, requiring us to store them in strong form
  and parse them out when printing type interfaces.

- The TypeBase::getAllGenericArgs() method did not do the
  right thing for members of protocols and protocol extensions,
  and so instead of simple calls to Type::subst(), we had
  an elaborate 'ArchetypeTransformer' abstraction repeated
  in two places.

Rewrite this code to use GenericSignatures and
GenericFunctionType instead of old-school GenericParamLists
and PolymorphicFunctionType.

This changes the code completion and AST printer output
slightly. A few of the changes are actually fixes for cases
where the old code didn't handle substitutions properly.
A few others are subjective, for example a generic parameter
list of the form <T : Proto> now prints as <T where T : Proto>.

We can add heuristics to make the output whatever we want
here; the important thing is that now we're using modern
abstractions.
2016-10-02 23:49:15 -04:00
Michael Ilseman
d625ed288e [ClangImporter] remove antiquated swift_newtype options 2016-09-09 13:55:20 -07:00
Doug Gregor
eb3ba78d94 Remove the swift3_migration attribute.
This attribute was a (my) bad idea that we ended up not using. Kill it.
2016-08-19 14:04:06 -07:00
Argyrios Kyrtzidis
80b3f56b40 [AST] Fix the cursor-info tests with these changes:
- Make sure VarDecls have an associated TypeLoc, like ParamDecls do, then use it for printing the VarDecl's type.
This is done by moving ParamDecl's TypeLoc up to the VarDecl.
This is useful for being able to display the parameter names of function types embedded in VarDecls.

- Use the result TypeLoc of functions for printing. This enables printing parameter names of function types embedded in return types.

- Make sure to annotate attributes while they are printed.
2016-08-09 20:52:09 -07:00
Jordan Rose
b5aca663bc [ClangImporter] Remove importer-based NS stripping. (#3880)
* [ClangImporter] Remove importer-based NS stripping.

As Tony puts it, in the end we wound up with more Foundation
declarations imported as members or keeping "NS" than those that
dropped it, and any further decisions will be made on a case-by-case
basis. Move all of the existing cases of prefix-stripping into
Foundation's API notes and drop the logic from the compiler.

Tested by dumping the generated interface for Foundation and its
submodules for both macOS and the iOS simulator, and comparing the
results. A few cases did slip through here because of the interaction
between "SwiftName" and "Availability: nonswift".

The next commit will re-add "NS" to some stragglers that we missed.

rdar://problem/26880017

* APINotes: Add "NS" back to a few types.

NSKeyedUnarchiverDelegate
NSKeyedArchiverDelegate
NSTextCheckingTypes
NSBinarySearchingOptions
NSEnumerationOptions
NSSortOptions

More rdar://problem/26880017

* Remove now-redundant SwiftNames from API notes.

No change observed in the generated interface of Foundation and its
submodules.

Finishes rdar://problem/26880017.
2016-08-01 20:54:26 -07:00
Argyrios Kyrtzidis
05d495116d [IDE/test] Distinguish a call argument name appropriately for testing. 2016-08-01 10:20:07 -07:00
Ben Langmuir
e3c9f770f4 [swift-ide-test] Add -debug-constraints option; add logging to typeCheckUnresolvedExpr
I keep wanting to debug type-checking of unresolved members, so add the
logic so I can enable it from swift-ide-test rather than having to
modify the source.
2016-07-29 09:31:32 -07:00
Argyrios Kyrtzidis
e1d3183c70 [swift-ide-test] Introduce '-print-decl' option.
This is helpful for understanding how specific APIs are imported.
2016-07-26 22:20:48 -07:00
swift-ci
035823591a Merge pull request #3620 from nkcsgexi/syntax-kind 2016-07-21 03:14:23 -07:00
Luke Larson
74e0498015 Revert "Update master to build with Xcode 8 beta 3, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs."
This reverts commit 62d1fa760c.
2016-07-19 15:18:17 -07:00
Xi Ge
195c737b54 [libIDE] Add syntax kind of argument to fix a crash. rdar://27377118
Argument used to have the same syntax kind with that of parameter. This patch
starts to differentiate them.
2016-07-19 15:10:46 -07:00
Mishal Shah
62d1fa760c Update master to build with Xcode 8 beta 3, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2016-07-19 22:31:34 +02:00
Xi Ge
2a860100a5 [SourceKit] Implement a new SourceKit request to generate the interface for a given type. rdar://27306890 (#3586)
This patch allows SourceKit to generate the interface for a given type specified by its mangled name.
Type interface is refined decl printing with type parameters localized and unusable members hidden.

Required field:
   "key.request": "source.request.editor.open.interface.swifttype"
   "key.usr": the mangled name of the given type.
2016-07-18 18:05:47 -07:00
Xi Ge
17e49422e7 [libIDE] Refactor type-interface APIs. (#3537) 2016-07-15 15:59:22 -07:00
Xi Ge
8cfefd35ce [libide] Finish related lib-ide work on generating type-interface, rdar://27306890. (#3501) 2016-07-14 08:48:28 -07:00
David Farler
c9f5504797 Cascading Doc Comments: Look up class hierarchy when doc comments are missing
If a class member doesn't have a doc comment but a base class does, show
the base class's comment and add a note about where it came from.

rdar://problem/16512247
2016-06-27 11:55:31 -07:00
Doug Gregor
a2e03d556b Stage implementation of SE-0033 behind a flag, -enable-swift-newtype.
We're going to quarantine this feature behind a frontend flag for a
bit.
2016-04-25 18:03:04 -07:00
David Farler
a9297eed9f Rename llvm::markup namespace to swift::markup
This was naming was cargoed from long ago and this functionality isn't
directly related to LLVM, it's specific to Swift.
2016-04-10 13:46:25 -07: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
Ben Langmuir
4d9c9f6098 Move SourceEntityWalker into libAST NFC
It fits right in among our other AST walkers and lets us use it lower in
the stack than libIDE.
2016-04-01 14:14:06 -07: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
37f5a0390a [SourceKit] DocInfo: Add a new entry to indicate the default implementation of a protocol member in its extensions. rdar://25032869 2016-03-30 14:26:17 -07:00
Xi Ge
b313668ca2 IDETypeChecking: Add a function to collect protocol members who have default implementations in protocol extensions. Need for rdar://25032869 2016-03-29 18:01:53 -07:00
Xi Ge
3a3295f053 swift-ide-test: Add an option to allow users to specify a second source file to test with. 2016-03-25 14:14:19 -07:00
Michael Ilseman
47e73ad4f1 Merge branch 'master' of github.com:apple/swift into import-as-member 2016-03-23 17:01:47 -07:00
Michael Ilseman
7867533f2c Merge commit 'b894798e461077b30a3aa4afe89639f312f44858' into import-as-member 2016-03-23 15:40:04 -07:00
Michael Ilseman
1f8e887c7e Merge commit '38ceced77984188b25af9673ea61b28dc4c90b60' into import-as-member 2016-03-23 14:30:48 -07:00
Michael Ilseman
d7581d1b36 Merge commit 'a31edf53d0580efe47f4e9ef89dccc4429c056e8' into import-as-member 2016-03-23 13:05:57 -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
Ben Langmuir
0f53e1a5be [IDE] Also print decl refs for reconstruct type
Makes it easier to check implicit decls, or things from other modules.
Only print the ones we haven't seen before to reduce the output.
2016-03-16 21:24:04 -07:00
Ben Langmuir
ba7ec862ce [IDE] Try to make the reconstruct type output more amenable to testing NFC
Shorten the boilerplate and Put the stuff you want to match in tests at
the beginning of the lines (the resolved decl or type).

Also put the USR/mangled name into the output (at the very end), since
it is useful when trying to debug a failure.
2016-03-16 21:24:04 -07:00
Xi Ge
81f08175f2 swift-ide-test: Add an option to specify whether printing new lines between members. 2016-03-16 17:29:37 -07:00
Ben Langmuir
47d2c24078 [IDE] Factor code that looks up USRs into getDeclFromUSR 2016-03-16 15:43:02 -07:00
Xi Ge
a9727dbace ModuleGroup: Add several subgroups. 2016-03-15 17:00:00 -07:00
Xi Ge
d0e176810f [Serialization] Serialize doc comments for extensions. Need this for rdar://25157796
We did not serialize them because getting USR for extensions is tricky (USRs are
usually for value decls). This commit starts to make up an USR for an extension by combining
the extended nominal's USR with the USR of the first value member of the extension. We use
this made-up USR to associate doc comments when (de)serializing them.
2016-03-15 13:35:07 -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
2e56083a43 [IDE] Switch to using symbol names for reconstructing types
This is closer to what the debugger and USRs will look like, and
includes more context needed in some cases.
2016-03-11 15:39:32 -08:00
Ben Langmuir
fd7c2fbc46 [IDE] Remove dead code NFC 2016-03-11 14:25:38 -08:00
Ben Langmuir
d51c0f1aa7 [IDE] StringRefize the ReconstructType APIs NFC
Luckily const char* clients can work unmodified.
2016-03-11 14:24:32 -08:00
Jordan Rose
677552f790 Mangle private discriminators into typealias names.
...by mangling them the same as any other value decl. This is important for debug info to
preserve and recover a private typealias.

rdar://problem/24921067
2016-03-10 10:41:52 -08:00
Ben Langmuir
2938162a53 [IDE] Remove some recently added dead code NFC
I switched to using printUSR but forgot to delete the mangling calls.
2016-03-10 09:23:09 -08:00
Ben Langmuir
5481743bc7 [IDE] Remove some unnecessary string escapes 2016-03-09 21:14:30 -08:00
Ben Langmuir
5725d22c89 [IDE] Add an entry point to get decls out of 'ReconstructType'
For now, just tack the testing onto the existing walker that checks the
types.  It doesn't seem to work at all for local declarations yet, but
at least we get some top-level stuff.
2016-03-09 21:14:29 -08:00
Ben Langmuir
fef998d7dc Fix a couple of 80-column violations in swift-ide-test NFC
and simplify some printing.
2016-03-08 20:39:45 -08:00
Michael Ilseman
1b83dee698 [Clang importer] Inferr import as member flags
Plumbing for -enable-infer-import-as-member options and flags.Tests
coming soon.
2016-03-06 23:54:56 -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