Commit Graph

235 Commits

Author SHA1 Message Date
Dmitri Hrybenko
d938b93e48 stdlib: doc comment: use monospaced font for code
rdar://20843980

Swift SVN r28255
2015-05-07 04:59:50 +00:00
Dmitri Hrybenko
8ac6c7cf8f Remove {Dictionary,Set,UnsafeMutableBufferPointer,UnsafeBufferPointer}.count
These APIs are redundant with APIs that come from protocol extensions.

Swift SVN r28248
2015-05-07 00:30:43 +00:00
Dmitri Hrybenko
58601fafc8 Remove Array.count, it is redundant with protocol extensions
Swift SVN r28247
2015-05-07 00:30:41 +00:00
Dmitri Hrybenko
c109ec9125 stdlib: protocol extensions: de-underscore count()
Swift SVN r28246
2015-05-07 00:30:38 +00:00
Dmitri Hrybenko
e253881b02 stdlib: protocol extensions: de-underscore indices
Swift SVN r28245
2015-05-07 00:30:35 +00:00
Dmitri Hrybenko
f76ca6243e stdlib: protocol extensions: de-underscore indexOf()
Swift SVN r28244
2015-05-07 00:30:33 +00:00
Dmitri Hrybenko
25e74d21db stdlib: protocol extensions: de-underscore last
Swift SVN r28243
2015-05-07 00:30:32 +00:00
Dmitri Hrybenko
d790954154 stdlib: protocol extensions: de-underscore first
Swift SVN r28242
2015-05-07 00:30:30 +00:00
Dmitri Hrybenko
e96ade89a9 stdlib: protocol extensions: de-underscore isEmpty
Swift SVN r28241
2015-05-07 00:30:29 +00:00
Dmitri Hrybenko
275cfc0545 stdlib: protocol extensions: de-underscore underestimateCount()
Swift SVN r28240
2015-05-07 00:30:28 +00:00
Dmitri Hrybenko
97db2def53 stdlib: protocol extensions: de-underscore flatMap()
Swift SVN r28239
2015-05-07 00:30:27 +00:00
Dmitri Hrybenko
a474641f66 stdlib: protocol extensions: de-underscore reverse()
Swift SVN r28238
2015-05-07 00:30:26 +00:00
Dmitri Hrybenko
270ec3b67c stdlib: protocol extensions: de-underscore reduce()
Swift SVN r28237
2015-05-07 00:30:25 +00:00
Dmitri Hrybenko
035d72d5a7 stdlib: protocol extensions: de-underscore contains()
Swift SVN r28236
2015-05-07 00:30:24 +00:00
Dmitri Hrybenko
822ad74194 stdlib: protocol extensions: de-underscore lexicographicalCompare()
Swift SVN r28235
2015-05-07 00:30:23 +00:00
Dmitri Hrybenko
78d1196f33 stdlib: protocol extensions: de-underscore elementsEqual
Swift SVN r28234
2015-05-07 00:30:22 +00:00
Dmitri Hrybenko
e43ad56a1c stdlib: protocol extensions: de-underscore startsWith()
Swift SVN r28233
2015-05-07 00:30:21 +00:00
Dmitri Hrybenko
62aa1f0e7c stdlib: protocol extensions: de-underscore minElement(), maxElement()
Swift SVN r28232
2015-05-07 00:30:20 +00:00
Dmitri Hrybenko
7e9063a4af stdlib: protocol extensions: de-underscore enumerate()
Swift SVN r28231
2015-05-07 00:30:12 +00:00
Chris Lattner
37f5452d15 require -> guard.
Swift SVN r28223
2015-05-06 22:53:38 +00:00
Joe Groff
ab09922966 Runtime/IRGen: Replace the _SwiftNativeNS*Base +load hack with a compiler hack.
Rather than swizzle the superclass of these bridging classes at +load time, have the compiler set their ObjC runtime base classes, using a "@_swift_native_objc_runtime_base" attribute that tells the compiler to use a different implicit base class from SwiftObject. This lets the runtime shed its last lingering +loads, and should overall be more robust, since it doesn't rely on static initialization order or deprecated ObjC runtime calls.

Swift SVN r28219
2015-05-06 22:00:59 +00:00
Doug Gregor
2105aa7394 Remove extraneous 'Self.' from constrained extension where clauses.
NFC; cleans up the standard library implementation slightly.

Swift SVN r28209
2015-05-06 17:05:29 +00:00
Joe Groff
608e84496a AST/stdlib: Stub out _OptionSetType as a known protocol.
Leave it empty for now. The implementation can be dropped in later.

Swift SVN r28205
2015-05-06 16:49:01 +00:00
Dmitri Hrybenko
cd652bf6cd stdlib: canonicalize 'x.count == 0' to x.isEmpty
Swift SVN r28202
2015-05-06 16:27:41 +00:00
Dmitri Hrybenko
c31330ee1a stdlib: canonicalize 'x.count == 0' to x.isEmpty
Swift SVN r28196
2015-05-06 03:04:23 +00:00
Dmitri Hrybenko
7ab0f987bf stdlib: fix coding style
Swift SVN r28189
2015-05-06 00:06:05 +00:00
Dmitri Hrybenko
f0d5dfed97 stdlib: correct comment
Swift SVN r28188
2015-05-06 00:05:07 +00:00
Dave Abrahams
29e08e8814 [stdlib] Fix up Mirrors for the Linux bot
Swift SVN r28182
2015-05-05 21:44:13 +00:00
Chris Lattner
85d681a5b6 strength reduce some non-performance sensitive code :-)
Like the FIXME comment states, this method should probably
be changed to be:

  public func getMirror() -> MirrorType {
    return _OptionalMirror<T>(self)
  }

but I don't know how to test that change.



Swift SVN r28157
2015-05-05 05:48:54 +00:00
Dave Abrahams
f1177566d3 [stdlib] Fixes a bug in mirrors for ObjC superclasses
We had failed to recognize that legacy ObjC class mirrors have a
distinct type.  Fixes <rdar://20811737>

However, there's a bug in legacy mirrors that prevents all base classes
from being properly reflected: <rdar://20813711>

Swift SVN r28156
2015-05-05 05:40:22 +00:00
Chris Lattner
6a5009e0ce implement <rdar://problem/17013042> T! <-> T? conversions should not produce a diamond
Two pieces to this: 
 - Peephole OptionalEvaluationExpr(InjectOptionalExpr(BindOptionalExpr(X))) to  bitcast x to the result type. 
 - Enhance OptionalEvaluationExpr to delete the failure block if not needed.  

This is the same as r28150, but it includes a fix for the case when a non-address-only type
is initializing a contextally-provided-and-addressible buffer, tested by the new 
testContextualInitOfNonAddrOnlyType testcase.



Swift SVN r28153
2015-05-05 05:39:17 +00:00
Chris Lattner
9eb115fadf revert r28150, the perftestsuite isn't happy.
Swift SVN r28151
2015-05-05 05:16:23 +00:00
Chris Lattner
1ffe86b327 implement <rdar://problem/17013042> T! <-> T? conversions should not produce a diamond
Two pieces to this:
 - Peephole OptionalEvaluationExpr(InjectOptionalExpr(BindOptionalExpr(X))) to 
   bitcast x to the result type.
 - Enhance OptionalEvaluationExpr to delete the failure block if not needed.

This is the same as r28111, except that we finalize the initialization in the
address-only case.  A reduced testcase for the specific issue is added to
optional-casts.swift.



Swift SVN r28150
2015-05-05 05:01:22 +00:00
Dmitri Hrybenko
61d622226a Revert "Generate an empty Mirror for Mirror itself - the internal cruft of our reflection magic is not that interesting, and looks quite ugly in playgrounds"
This reverts commit r28141.  It broke the build.

Swift SVN r28143
2015-05-05 00:40:49 +00:00
Enrico Granata
6fcc3081ac Generate an empty Mirror for Mirror itself - the internal cruft of our reflection magic is not that interesting, and looks quite ugly in playgrounds
Swift SVN r28141
2015-05-05 00:18:42 +00:00
Chris Lattner
079e8b982b move stdlib from let/else to require.
Swift SVN r28098
2015-05-03 21:45:06 +00:00
Dmitri Hrybenko
e340bf410c stdlib: fix coding style
Swift SVN r28094
2015-05-03 04:10:59 +00:00
Dave Abrahams
bdc1e10362 [stdlib] 80-column fixups
Swift SVN r28078
2015-05-02 04:50:38 +00:00
Dave Abrahams
68b4314d47 [stdlib] Move String.CharacterView's implementation...
...into its own file.

Swift SVN r28077
2015-05-02 04:50:37 +00:00
Dave Abrahams
1198e2aa7a [stdlib] Fix a bug I committed.
Swift SVN r28076
2015-05-02 04:41:43 +00:00
Dave Abrahams
1947d705b5 [stdlib] add some // @testable comments...
...to public declarations that are accessible only for testing purposes

Swift SVN r28074
2015-05-02 04:33:13 +00:00
Dave Abrahams
5d1da8d350 [stdlib] Update String doc comments...
...for the addition of CharacterView

Swift SVN r28073
2015-05-02 04:33:12 +00:00
Dave Abrahams
8782859b91 [stdlib] Add a caveat to doc comment
Swift SVN r28072
2015-05-02 04:33:11 +00:00
Dave Abrahams
4ce1891cae [stdlib] String is no longer a SequenceType
<rdar://20494686>

String itsef should only expose Unicode-correct algorithms, like proper
substring/prefix/suffix search, enumerating words/lines/paragraphs, case
folding etc. Promoting sequence-centric algorithms to methods on String
is not acceptable since it invites users to write wrong code. Thus,
String has to lose its SequenceType conformance.

Nevertheless, we recognize that sometimes it is useful to manipulate the
String contents on lower levels (UTF-8, UTF-16, Unicode scalars,
extended grapheme clusters), for example, when implementing high-level
Unicode operations, so we can't remove low-level operations
altogether. For this reason, String provides nested "views" for the
first three low-level representations, but grapheme clusters were in a
privileged position -- String itself is a collection of grapheme
clusters. We propose to add a characters view that will represent the
String as a collection of Character values.

Swift SVN r28065
2015-05-02 01:52:02 +00:00
Andrew Trick
5bc23acf75 Add wrappers around Builtin.isUnique.
Currently they do nothing but allow stdlib code to use regular (Bool)
types.  However, soon the wrappers for the _native variants will
provide point-of-use sanity checking.

These need to be fully generic to support class protocols and
single-payload enums (not just for optional). It also avoids a massive
amount of overloading for all the reference type variations
(AnyObject, Native, Unknown, Bridge) x 2 for optional versions of
each.

Because the wrapper is generic, type checking had to be deferred until
IRGen. Generating code for the wrapper itself will result in an
IRGen-time type error. They need to be transparent anyway for proper
diagnostics, but also must be internal.

Note that the similar external API type checks ok because it
forces conformance to AnyObject.

The sanity checks are disabled because our current facilities for
unsafe type casting are incomplete and unsound. SILCombine can
remove UnsafeMutablePointer and RawPointer casts by assuming layout
compatibility. IRGen will later discover layout incompatibility and
generate a trap.

I'll send out a proposal for improving the casting situation so we can
get the sanity checks back.

Swift SVN r28057
2015-05-01 23:45:44 +00:00
David Farler
91c64fdbb1 Stop re-exporting the Objective-C library
and link it properly. This is needed to embed LLVM bitcode sections
in the standard library and overlays. The linker doesn't support
embedded bitcode and reexport flags (among others).

rdar://problem/20750099

Swift SVN r28052
2015-05-01 22:24:14 +00:00
Dmitri Hrybenko
b2f1ffbe51 stdlib: constrain CollectionType.SubSlice further
The blocking compiler bug was fixed.

Swift SVN r28038
2015-05-01 09:34:34 +00:00
Ted Kremenek
9f5437e2bc Make 'toInt()' unavailable instead of deprecated.
Swift SVN r28029
2015-05-01 06:25:52 +00:00
Devin Coughlin
0c82636156 Runtime: Enable run-time availability checks for tvOS
Change _stdlib_isOSVersionAtLeast on tvOS to actually check the running
OS version rather than always returning false. It still always returns false on
watchOS; rdar://problem/20234735 tracks that.

rdar://problem/20663303

Swift SVN r28024
2015-05-01 05:10:47 +00:00
Ted Kremenek
5a5454569f Make deprecated protocols 'Printable' and 'DebugPrintable' unavailable.
Swift SVN r28020
2015-05-01 04:14:50 +00:00