Commit Graph

3980 Commits

Author SHA1 Message Date
Ben Langmuir
69967ca45c [CodeCompletion] Identify known operators and force a fixed sort order
In the new code-completion code path, force any known operators to go
through a fixed sort order. To identify operators unambiguously, add a
new BuiltinOperator code-completion kind to handle non-decl operators
(!, ., ?., and =).

rdar://problem/25994246
rdar://problem/23440367
2016-05-03 10:23:13 -07:00
Ted Kremenek
b8bbed8c13 [WIP] Implement SE-0039 (Modernizing Playground Literals) (#2215)
* Implement the majority of parsing support for SE-0039.

* Parse old object literals names using new syntax and provide FixIt.

For example, parse "#Image(imageLiteral:...)" and provide a FixIt to
change it to "#imageLiteral(resourceName:...)".  Now we see something like:

test.swift:4:9: error: '#Image' has been renamed to '#imageLiteral
var y = #Image(imageLiteral: "image.jpg")
        ^~~~~~ ~~~~~~~~~~~~
        #imageLiteral resourceName

Handling the old syntax, and providing a FixIt for that, will be handled in a separate
commit.

Needs tests.  Will be provided in later commit once full parsing support is done.

* Add back pieces of syntax map for object literals.

* Add parsing support for old object literal syntax.

... and provide fixits to new syntax.

Full tests to come in later commit.

* Improve parsing of invalid object literals with old syntax.

* Do not include bracket in code completion results.

* Remove defunct code in SyntaxModel.

* Add tests for migration fixits.

* Add literals to code completion overload tests.

@akyrtzi told me this should be fine.

* Clean up response tests not to include full paths.

* Further adjust offsets.

* Mark initializer for _ColorLiteralConvertible in UIKit as @nonobjc.

* Put attribute in the correct place.
2016-04-25 07:19:26 -07:00
Michael Gottesman
d89f252deb Merge remote-tracking branch 'origin/master' into master-next 2016-04-18 02:26:06 -07:00
Trent Nadeau
5301d5cd82 Added (non)mutatingvariant doc fields 2016-04-15 16:13:22 -04:00
Jordan Rose
bc83940301 Make pointer nullability explicit using Optional.
Implements SE-0055: https://github.com/apple/swift-evolution/blob/master/proposals/0055-optional-unsafe-pointers.md

- Add NULL as an extra inhabitant of Builtin.RawPointer (currently
  hardcoded to 0 rather than being target-dependent).
- Import non-object pointers as Optional/IUO when nullable/null_unspecified
  (like everything else).
- Change the type checker's *-to-pointer conversions to handle a layer of
  optional.
- Use 'AutoreleasingUnsafeMutablePointer<NSError?>?' as the type of error
  parameters exported to Objective-C.
- Drop NilLiteralConvertible conformance for all pointer types.
- Update the standard library and then all the tests.

I've decided to leave this commit only updating existing tests; any new
tests will come in the following commits. (That may mean some additional
implementation work to follow.)

The other major piece that's missing here is migration. I'm hoping we get
a lot of that with Swift 1.1's work for optional object references, but
I still need to investigate.
2016-04-11 20:06:38 -07:00
practicalswift
ba5de12177 [gardening] Fix recently introduced typo: "an swift" → "a swift" 2016-04-11 11:56:30 +02:00
David Farler
a6b410bcb1 Add rudimentary nested closure param/return/throws support for Doxygen
There isn't a great nested argument feature that we can use in our
Doxygen emitter but we can approximate it by nesting unordered lists
with labels.

rdar://problem/24794725
2016-04-10 17:14:56 -07:00
David Farler
c20f3db09e Nesting parameter/returns/throws doc comments for closure parameters
Under parameter doc comment list items, allow function doc comment
syntax to nest so you can document the meaning of closure parameters'
signatures.

rdar://problem/24794725
2016-04-10 15:32:07 -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
John McCall
21e9f5949a Merge remote-tracking branch 'origin/master' into master-next 2016-04-08 13:29:39 -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
Dmitri Gribenko
336b7198f7 Merge pull request #2016 from danra/code_completion_includes
Fix includes order in CodeCompletion.cpp and add missing includes in …
2016-04-04 01:44:32 -07:00
danra
dae3731ab0 Cosmetic namespace comments/spacing fixes (NFC)
* Cosmetic namespace comments/spacing fixes (NFC)

* unnamed->anonymous namespace in comments (NFC)
2016-04-02 17:15:44 -07:00
swift-ci
fcbc4ceaa0 Merge pull request #2019 from danra/code_completion_using 2016-04-01 18:07:21 -07:00
Dan Raviv
af831051a1 Add using statements to improve readability and DRY 2016-04-02 01:01:24 +03:00
Dan Raviv
87a4058fb8 Fix includes order in CodeCompletion.cpp and add missing includes in CodeCompletionResultBuilder.h 2016-04-02 00:26:08 +03: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
Mark Lacey
b4787ffe79 Merge remote-tracking branch 'origin/master' into master-next 2016-03-31 16:15:11 -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
c452f9640f [CodeCompletion] Add a field NotRecommendedReason to code completion result to indicate why an item is not recommended, NFC. rdar://25415947
As implied in rdar://24818863, striking through a module name may be an overkill to suggest the module is redundant to import. We try to
fine-grain not-recommended-reason so that proper UI cue can be adopted in the future.
2016-03-30 16:23:33 -07:00
Ben Langmuir
968b0491b8 [CodeCompletion] Make Void-returning functions "NotRecommended" in typed context
When we know we're expecting an expression that returns a value, make
the completion "NotRecommended" to deprioritize it.

rdar://problem/22810741
2016-03-29 14:20:25 -07:00
Xi Ge
589d9a8a3e CodeFormat: Avoid indenting the close bracket of a closure if the closure is on the RHS of an assignment expression. rdar://24507930 2016-03-29 13:08:55 -07:00
Xi Ge
23d1b51e6f [CodeCompletion] Teach override completion to collect the associatedtypes that need to be specified from conforming protocols. 2016-03-29 11:17:00 -07:00
Michael Gottesman
0bc44a1436 [upstream-update] Update for removal of clang::LangOptions::ImplementationOfModule.
It was unified with ModuleName. Now a flag is set to say if ModuleName is the
implementation module or not.
2016-03-26 02:01:19 -07:00
Michael Ilseman
b01caa01c6 Merge remote-tracking branch 'origin/master' into import-as-member 2016-03-25 15:47:47 -07:00
Xi Ge
e7faebeb40 Address @benlangmuir's code review comments. 2016-03-25 14:25:41 -07:00
Xi Ge
c94172869b Re-apply "[CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863" 2016-03-25 14:14:19 -07:00
Dmitri Gribenko
904b7f53c0 Revert "[CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863"
This reverts commit 218010afb9.  It causes
timeouts in IDE/complete_repl_from_cocoa.swift.
2016-03-25 14:14:19 -07:00
Xi Ge
baff806cf6 [CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863
Reported: http://stackoverflow.com/questions/36180575/struck-out-module-xcode-7-3
2016-03-25 14:14:19 -07:00
Xi Ge
016bca6f03 Re-apply "[CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863" 2016-03-25 11:45:51 -07:00
Dmitri Gribenko
856f3b1cb7 Revert "[CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863"
This reverts commit 218010afb9.  It causes
timeouts in IDE/complete_repl_from_cocoa.swift.
2016-03-25 11:01:29 -07:00
Xi Ge
218010afb9 [CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863
Reported: http://stackoverflow.com/questions/36180575/struck-out-module-xcode-7-3
2016-03-24 17:44:46 -07:00
Michael Ilseman
8759905351 Merge remote-tracking branch 'origin' into import-as-member 2016-03-24 11:37:36 -07:00
Xi Ge
fda0751cae [SourceKit] In interface-gen request, allow clients to send SourceKit an interested USR from which we can infer the group name. 2016-03-23 17:26:44 -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
Xi Ge
f338bdfbb7 [SourceKit] Incorporate synthesized extensions into DocInfo request. rdar://24912860
This commit reuses our code for generating synthesized extensions from module printing to enhance
documentation generation.
2016-03-22 14:49:22 -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
practicalswift
ac87f428ea [gardening] Fix formatting of recently introduced headers. 2016-03-22 21:36:09 +01: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
Ben Langmuir
65719e8ce0 Merge pull request #1686 from regnerjr/swift-format_SR-146
[SourceKit] Move Code Formatting Logic to libIDE
2016-03-21 13:52:09 -07:00
Ben Langmuir
b0bc53d5bb Reapply "[ReconstructType] Fix decl lookup when there are multiple constructors"
This was mistakenly reverted in an attempt to fix bot failures.  It
turned out to be a different commit that was responsible, so reapply.
Original commit message was:

We were failing to find init() decls whenever there was more than one
candidate.

The mangled function type we get will be (args...) -> T, but the real
thing is (T.Type) -> (args...) -> T. Strip the metatype so we can match
successfully.
2016-03-21 11:39:44 -07:00
Ben Langmuir
b842160f85 [CodeCompletion] Don't complete operator = after Void result
print(1) = blah

doesn't make much sense.
2016-03-21 11:39:42 -07:00
Michael Ilseman
e86d3bde6c Revert "[ReconstructType] Fix decl lookup when there are multiple constructors"
This reverts commit 65c86b713d.

I attempted to resolve the merge conflict, but Jordan will need to do
a second check.
2016-03-20 20:00:37 -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
701277e751 Allow SourceEntityWalker to visit operator decls, so that they can get indented properly. rdar://25246628 2016-03-19 14:47:58 -07:00
John Regner
5b9fc3d832 [SourceKit] Add reformat function to libIDE
Move all the rest of the code formatters and helper classes out of the interface.
2016-03-18 21:37:00 -07:00
John Regner
e63678579b [SourceKit] Moved Formatting files into place in libIDE 2016-03-18 21:19:57 -07:00