Commit Graph

247 Commits

Author SHA1 Message Date
Joe Groff
5bfd6cc0c7 Update SourceKit tests for id-as-Any. 2016-07-25 06:40:36 -07:00
Slava Pestov
ddc51c5917 AST: Implement SE-0102, introducing new semantics for Never alongside @noreturn
No migrator support yet, and the code for @noreturn is still in
place.
2016-07-22 14:56:39 -07:00
Doug Gregor
80f0852504 [SE-0091] Allow 'static' operators to be declared within types and extensions thereof.
Allow 'static' (or, in classes, final 'class') operators to be
declared within types and extensions thereof. Within protocols,
require operators to be marked 'static'. Use a warning with a Fix-It
to stage this in, so we don't break the world's code.

Protocol conformance checking already seems to work, so add some tests
for that. Update a pile of tests and the standard library to include
the required 'static' keywords.

There is an amusing name-mangling change here. Global operators were
getting marked as 'static' (for silly reasons), so their mangled names
had the 'Z' modifier for static methods, even though this doesn't make
sense. Now, operators within types and extensions need to be 'static'
as written.
2016-07-18 23:18:57 -07:00
Xi Ge
3cc0b1df61 [libIDE] When printing type interface, ensure we translate 'Self' to the type under printing. rdar://27306890 (#3514) 2016-07-14 15:50:49 -07:00
Doug Gregor
823c24b355 [SE-0112] Rename ErrorProtocol to Error.
This is bullet (5) of the proposed solution in SE-0112, and the last
major piece to be implemented.
2016-07-12 10:53:52 -07:00
Xi Ge
64efa48c65 [SourceKit][DocInfo] When the underlying type of a type alias decl exists, report the conformances of the underlying type. rdar://26408167 (#3394)
Showing only the conforming associated types provides
little information to doc viewers. This patch digs the
underlying type of an associated type to report the
conformance info of those.
2016-07-07 16:24:01 -07:00
Ingmar Stein
4f800f8a21 [ClangImporter] Import preprocessor constants with a cast
Addresses SR-1509 by adding a heuristic to import numeric literals with a
type cast. Two new cases have been added for macros with 4 or 5 tokens
to cover cases with or without sign tokens.
2016-06-29 23:01:30 +02:00
Brian Croom
98e3ca8bc4 Annotate some SourceKit tests that fail on Linux.
* A bunch of them require objc_interop because they import code containing
  Objective-C.
* Many others fail on Ubuntu 14.04 because the C++ there doesn't have a
  functional std::regex implementation which is required by the
  `complete-test` tool.

It may be possible to adjust some of these tests in the future to not
need these extra requirements, but this is a straightforward way to
clean up Linux test results for now.
2016-06-14 08:55:48 -04:00
Dmitri Gribenko
d5157c85da Fix test SourceKit/DocSupport/doc_clang_module.swift 2016-06-09 07:57:28 -07:00
Arnold Schwaighofer
f9e1d53523 Disable failing test for now
This started failing after one of the two commits:

[stdlib] Add missing discardableResult attribute
Fixes SR-1695: Option Set insert needs @discardableResult

[gardening] Remove unused diagnostic
attr_warn_unused_result_mutable_variable

These commits seem harmless so I disabled the test pending further
investigation.

rdar://26718415
2016-06-09 07:09:18 -07:00
Nate Cook
8e2ec66bdc [stdlib] Remove 'Returns' fields from initializers
This includes an updated fixture for `SourceKit/DocSupport/
doc_clang_module.swift', which depends on the OptionSet documentation.
2016-05-27 10:10:56 -05:00
Nate Cook
dee12dca75 [stdlib] Update tests for new String documentation
In addition to a new test fixture for 'SourceKit/DocSupport/
doc_clang_module.swift', this removes the check for an ASCII-only
generated standard library interface from 'SourceKit/InterfaceGen/
gen_stdlib.swift'.
2016-05-22 03:11:00 -05:00
Jordan Rose
2fa3da4089 Drop the notion of "alias" names for CF types.
Previously we imported a Core Foundation type "CCFooRef" as "CCFoo",
but also provided a typealias "CCFooRef". In Swift 3, we decided to
mark "CCFooRef" unavailable to force developers to consistently use
"CCFoo". Now that we have infrastructure to mark /all/ renamed
declarations as unavailable, just use that to track the renaming,
i.e. pretend that "CCFooRef" was the "Swift 2" name for the type.

This doesn't change the conflict resolution behavior: if there's
another name "CCFoo" in the same module, the CF type will be
imported as just "CCFooRef".

Groundwork cleanup for rdar://problem/26347297, which notes that our
import-as-member fix-its use the "Ref" names rather than the short
names.
2016-05-19 13:21:47 -07:00
Nate Cook
982e3d09f8 [stdlib] Revise documentation for new indexing model
This revises and expands on documentation for the new collection methods
for working with indices and the revised Swift 3 set APIs. In addition,
it includes documentation for the new range types.
2016-05-19 10:16:14 -05:00
Dmitri Gribenko
9aece73efb stdlib: add migration aids for SetAlgebra API
rdar://problem/26227732
2016-05-17 20:06:59 -07:00
Trent Nadeau
0cc851568a Updated tests to use @discardableResult and _ = . 2016-05-11 22:53:38 -04:00
Trent Nadeau
6e327b4ddb Updated stdlib to use @discardableResult and _ = . 2016-05-11 22:53:37 -04:00
Nate Cook
dfa89150c8 [stdlib] Update test depending on doc comments 2016-05-09 16:41:44 -05:00
Jorge Bernal
0a3f913b20 SE-0070: Make Optional Requirements Objective-C-only.
Optional protocol requirements now require an explicit @objc attribute.

Fixes SR-1395
2016-05-06 11:05:52 +02:00
practicalswift
d804026b34 [gardening] Fix "a" vs. "an" issues. 2016-05-01 13:29:57 +02:00
Nate Cook
21df5f203a [stdlib] Fix errant tests
- A benchmark method was renamed during the Set API batch revisions
- The SourceKit test that includes stdlib docs needed a new fixture
2016-04-27 11:13:44 -05:00
Dmitri Gribenko
263d6a4135 Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-26 21:15:13 -07:00
Dave Abrahams
debde16e2c Merge set-api branch into swift-3-indexing-model 2016-04-26 15:56:42 -07:00
Doug Gregor
2477206ed4 [Clang importer] Mark discardableResult attribute "implicit".
The Clang importer implicitly synthesizes @discardableResult for
nearly all imported functions. Printing this attribute in the
generated interface leads to a lot of noise. Mark it as implicit so we
don't print it.
2016-04-26 14:48:39 -07:00
Dmitri Gribenko
b75d2b9df4 Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-25 13:50:09 -07:00
Nate Cook
099c395473 Fix test expectation for SourceKit test that depends on stdlib docs 2016-04-25 12:59:39 -05:00
Xi Ge
c4d7b1a185 ASTPrinter: never synthesize extensions for raw types of enum decls.
Even thought raw types are specified in inheritance clauses, their
members are not usable through an enum instance. Thus, there is no
point to synthesize their members.
2016-04-22 22:52:46 -07:00
Dmitri Gribenko
0984f81a50 Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-22 18:56:35 -07:00
Jordan Rose
7ad6a8bd61 [test] Fix SourceKit tests for 2e38280.
Also filed <rdar://problem/25858559> "SourceKit response info for
enum shouldn't include members of the raw type" to keep it from
happening again.
2016-04-21 11:50:27 -07:00
Dmitri Gribenko
fc8d62dfbb Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-18 14:40:06 -07:00
Dmitri Gribenko
0c5933c2c4 Regenerate expected output for doc_clang_module.swift and doc_swift_module.swift SourceKit tests 2016-04-18 14:14:51 -07:00
Dmitri Gribenko
10697f939f Merge commit '510f29abf77e202780c11d5f6c7449313c819030' into swift-3-indexing-model 2016-04-14 13:45:27 -07:00
Michael Buckley
daa4714864 Merge branch 'master' into int-from-unsafepointer 2016-04-13 20:44:08 -07:00
Michael Buckley
8e8e61b0bc Add inititializers to Int and UInt which take UnsafePointers and UnsafeMutablePointers 2016-04-12 20:03:11 -07:00
Chris Lattner
066f285fbc tweak a few testcases that still fail with the @discardableResult attribute being auto-applied by the clang importer. 2016-04-12 19:40:09 -07:00
Trent Nadeau
8a55e428f4 Imported C decls w/o warn_unused_result get @discardableResult 2016-04-13 00:39:07 +00: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
Jordan Rose
1c25faaec3 [test] Adjust SourceKit test for CF importing.
The test was supposed to use a CF type, but it wasn't updated
for the switch from a naming convention to an attribute. This
restores the original intent (and unfortunately slides all the
offsets).
2016-04-11 17:55:10 -07:00
David Farler
fbc220a036 Revert "Revert "Enable cmark smart punctuation in doc comments""
This reverts commit f723b86614 and
updates the IDE tests that incidentally included some punctuation.
No new tests are necessary - the character level tests are exercised
in cmark itself.
2016-04-10 13:32:43 -07:00
Trent Nadeau
f96ad263a8 Added @discardableResult attr to mutating functions 2016-04-07 23:27:38 +00: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
Xi Ge
173e954cc2 test: update IDE and SourceKit tests due to stdlib changes. 2016-04-05 15:19:28 -07:00
Xi Ge
ca93fa6d1b [SourceKit] DocInfo: Explicitly report the optionality of protocol members in response. rdar://25129725 2016-04-01 14:55:11 -07:00
Xi Ge
adc65bf609 [SourceKit] DocInfo: Simplify the type parameter names inside fully annotated decls. 2016-04-01 11:55:06 -07:00
Xi Ge
8afcf65fa2 [SourceKit] DocInfo: Update the UIdent for synthesized extensions to respect the synthesized targets instead of the original extended types. 2016-03-31 18:12:53 -07:00
Xi Ge
126bc4e942 [SourceKit] DocInfo: For synthesized extension, update their extended fields to the synthesized target instead of their original extended types. rdar://25439820 2016-03-31 17:53:21 -07:00
Xi Ge
16a23d79b4 [SourceKit] DocInfo: Update the printed doc comment for synthesized extensions therefore it reflects the synthesized targets explicitly. rdar://25439820 2016-03-31 17:53:21 -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
Ben Langmuir
cf53717a24 Update clang USR in test for r262695
Naturally this commit is revlocked with clang r262695.
2016-03-30 17:52:53 -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