Commit Graph

4650 Commits

Author SHA1 Message Date
Dave Abrahams
80a21c8c09 [stdlib] Fix my last commit (oops!)
Swift SVN r20772
2014-07-30 20:42:02 +00:00
Dave Abrahams
287e43ad3c [stdlib] Clean up the other half of array casts
Swift SVN r20771
2014-07-30 20:39:47 +00:00
Dave Abrahams
ab21c59977 [stdlib] Clean up half the array cast machinery
Swift SVN r20765
2014-07-30 18:22:31 +00:00
Dmitri Hrybenko
ec4f8d37f7 stdlib: fix a heap overflow that colud happen when appending to a string
slice

rdar://17855908

Swift SVN r20762
2014-07-30 18:04:36 +00:00
Dmitri Hrybenko
6296c14623 stdlib/_StringBuffer: documentation comments, coding style
Swift SVN r20759
2014-07-30 14:43:30 +00:00
Dmitri Hrybenko
190db64c18 stdlib: document current plan of record for reserveCapacity() semantics
rdar://16970908


Swift SVN r20758
2014-07-30 14:42:24 +00:00
Greg Parker
fe8618a3d2 Scrap the custom allocator until we have time to fix it.
The allocator's crimes include:
* It uses OS SPI that must not be used by non-OS apps.
* It does not play well with memory debugging tools like Instruments.
* It does not return memory to the OS in response to memory pressure.
* It is less tested than we would like because many configurations 
  inadvertently turn it off (such as running from Xcode).
* Its per-thread magazine implementation does not actually work.
* Its "try alloc" flag is incompletely implemented and never used.
* Its "zero fill" flag is unimplemented and inconsistently used.



Swift SVN r20757
2014-07-30 14:11:40 +00:00
Dmitri Hrybenko
cbdefd719b Unbreak iOS builds: there is no NSRectEdge on iOS
Swift SVN r20755
2014-07-30 13:08:11 +00:00
Dmitri Hrybenko
fc05064131 Foundation overlay: introduce correctly-typed NS{Min,Max}{X,Y}Edge constants
that correspond to macros in the SDK

... and revert the previous attempt at fixing this, r20269.

rdar://16593744


Swift SVN r20752
2014-07-30 11:33:25 +00:00
Dmitri Hrybenko
ac0d9b8175 stdlib/CGFloat: GYB'ify initializers that convert between CGFloat and
integer types.  Never miss an integer type again.

rdar://17853313

Swift SVN r20751
2014-07-30 11:24:11 +00:00
Dmitri Hrybenko
c17b692e20 stdlib: pull out information about integer types into a reusable file
Swift SVN r20750
2014-07-30 10:16:47 +00:00
Dmitri Hrybenko
bfb781492b Remove a Python bytecode file
Swift SVN r20743
2014-07-30 08:27:52 +00:00
John McCall
80dd63b38d Don't allocate values out-of-line just because they're
not bitwise takable.

Finishes rdar://16755731

Swift SVN r20742
2014-07-30 08:24:18 +00:00
John McCall
584795e505 Replace the typeOf value witness with an
initializeBufferWithTakeOfBuffer value witness.

Attempt to use initializeBufferWithTakeOfBuffer in
some appropriate places.

There are some changes enabled by this which are
coming in a follow-up patch.

Swift SVN r20741
2014-07-30 08:24:12 +00:00
John McCall
934527a029 Eliminate all uses of the typeof value witness.
Swift SVN r20734
2014-07-30 04:40:58 +00:00
Dave Abrahams
6e7f83fe98 Internalize old array casting entry-points
The core compiler now uses just two entry points for array casting

Swift SVN r20725
2014-07-29 23:56:51 +00:00
Dave Abrahams
6a80cbbaa2 [stdlib] Capitalize the cases of Bit
Fixes <rdar://problem/17821517>

Swift SVN r20718
2014-07-29 23:25:28 +00:00
Dave Abrahams
7c7fb3eea0 Restore "[Release note] deferred array cast checks"
I had just gone too far with the laziness; everything was already
working after only one change

Swift SVN r20717
2014-07-29 23:25:27 +00:00
Joe Pamer
1fec0afbd0 Disallow value-to-optional conversions between argument and parameter types when resolving overloads for operators applied to nil literal operands.
This is a targeted fix to address rdar://problem/16848110 ("Disallow non-optionals to be compared to nil") and its associated dupes.

Swift SVN r20716
2014-07-29 23:24:36 +00:00
Dave Abrahams
0b562db701 Revert "[Release note] deferred array cast checks"
This reverts commit r20700 and r20702

I'll bring these back when I work out the problems.

Swift SVN r20708
2014-07-29 22:52:28 +00:00
Dave Abrahams
18b81228d5 [stdlib] Defer array bridge cast checks
Part 2 (of 2) of <rdar://problem/17340393>

Swift SVN r20700
2014-07-29 21:41:11 +00:00
Dave Abrahams
5847a0f7c3 [stdlib] defer Array element down-cast checks
Part 1 of <rdar://problem/17340393>

Swift SVN r20699
2014-07-29 21:41:10 +00:00
Dave Abrahams
ebcaab1e52 [stdlib/core] add Array init from _CocoaArrayType
Swift SVN r20698
2014-07-29 21:41:09 +00:00
Dave Abrahams
01dd78ae99 [stdlib] Add missing _sanityCheck diagnostic
Swift SVN r20691
2014-07-29 21:01:26 +00:00
Dave Abrahams
a8225dabee [stdlib] ArrayBridge.swift => ArrayCast.swift
This file is really about array casting, and not (necessarily) bridging.
Bridging may be involved in some array casts, but is not involved in all
of them.

Swift SVN r20690
2014-07-29 20:58:54 +00:00
Dave Abrahams
0320ef85ab [stdlib] Consolidate array casting entry points
Swift SVN r20689
2014-07-29 20:54:24 +00:00
Dave Abrahams
c91e0f98a0 [stdlib] bugfix: Copy bridged NSMutableArray's
When NSArrays are bridged into Array<T>, they weren't being .copy()'d.
As a result, changes to an NSMutableArray (cast to NSArray), could cause
"unrelated" Swift Arrays to mutate.  Found by inspection while
bottlenecking unsafeBitCast's in Array implementation, which also
happens in this commit.

Swift SVN r20678
2014-07-29 17:59:41 +00:00
Dmitri Hrybenko
3e32ff188f stdlib/String: change String.stringByAbbreviatingWithTildeInPath into a
property, to match recent Foundation headers


Swift SVN r20674
2014-07-29 16:08:39 +00:00
Dmitri Hrybenko
a0c8140529 Reflection: fix a leak in TupleMirror
rdar://17840810


Swift SVN r20671
2014-07-29 15:08:48 +00:00
Dmitri Hrybenko
bdc78be4e5 Reflection: reorder dump() arguments so that one can print to a stream and take
advantage of default values

Also, fix dump() to actually print everything into the supplied stream.


Swift SVN r20670
2014-07-29 15:07:25 +00:00
Dmitri Hrybenko
8c277e35e9 StdlibUnittest: add a prototype of a Swift-based driver for trapping tests
This technique is about 10x faster than using lit as the driver.


Swift SVN r20668
2014-07-29 10:26:32 +00:00
Dave Abrahams
9a13a7148b [stdlib] Consolidate bridging protocols
Squash _[Conditionally]BridgedToObjectiveC into one protocol.  This
change results in simpler bridging code with fewer dynamic protocol
conformance checks, and solves the nasty naming/semantics problem that
resulted from having _ConditionallyBridgedToObjectiveC refining
_BridgedToObjectiveC.

Also, rename things so they're more symmetrical and less confusing.

Swift SVN r20664
2014-07-29 01:30:27 +00:00
Dave Abrahams
5496c4beac [stdlib] Default == for Strideables
...which we can provide now that <rdar://problem/17620349> is fixed.
Thanks, JoeP!

Swift SVN r20645
2014-07-28 21:14:53 +00:00
Dave Abrahams
6d1f574089 [stdlib] Separate file for Array bridging/casting
This stuff will require a nice big comment and will go through several
rounds of cleanup; let's get it out of the regular Array flow.

Swift SVN r20642
2014-07-28 20:34:08 +00:00
Joe Pamer
96a5df8281 Remove one more optional-as-boolean.
Swift SVN r20640
2014-07-28 19:20:42 +00:00
Joe Pamer
f55c751958 Add a fixit for optional-typed expressions used in conditional expression positions.
Swift SVN r20639
2014-07-28 19:20:42 +00:00
Joe Pamer
94dac129d4 Remove the BooleanType conformance from optional types (rdar://problem/17110911)
To limit user confusion when using conditional expressions of type Bool?, we've decided to remove the BooleanType (aka "LogicValue") conformance from optional types. (If users would like to use an expression of type Bool? as a conditional, they'll need to check against nil.)

Note: This change effectively regresses the "case is" pattern over types, since it currently demands a BooleanType conformance. I've filed rdar://problem/17791533 to track reinstating it if necessary.

Swift SVN r20637
2014-07-28 19:20:39 +00:00
Dave Abrahams
c76eeec0a5 [stdlib] Drop obsolete @availability
Swift SVN r20634
2014-07-28 18:31:34 +00:00
Dave Abrahams
214e2f03de [stdlib] Drop @availability for renamed protocols
...now that seed 5 has branched.

Fixes <rdar://problem/17672088> #Seed 6: Remove @availability for protocols

Swift SVN r20632
2014-07-28 18:14:27 +00:00
Dave Abrahams
4ece9b1734 [stdlib] Default bitwise assignment operators
|=, &=, and ^= now come along for free with a BitwiseOperationsType
conformance, so we can remove the special-cased operators for
RawOptionSetType.

Also, release notes.

Swift SVN r20630
2014-07-28 16:39:23 +00:00
Doug Gregor
bd75425b0e Remove the notion of non-inheritable conformances entirely <rdar://problem/16880016>.
Swift SVN r20627
2014-07-28 16:29:05 +00:00
Doug Gregor
3cb58e833a Restrict non-final class protocol conformance when Self is part of the requirement signature.
When a non-final class satisfies a method requirement that returns
Self, it must do so with a method that also returns (dynamic)
Self. This ensures conformance will be inheritable, closing off an
awful type-safety hole <rdar://problem/16880016>. Other
non-contravariant uses of Self in the signatures of requirements cause
the protocol to be unusable by non-final classes.

I had to leave a tiny little gaping hole for the ~> operator, whose
removal is covered by <rdar://problem/17828741>. We can possibly put
this on firm footing with clever handling of generic witnesses, but
it's not important right now.



Swift SVN r20626
2014-07-28 16:15:16 +00:00
Dave Abrahams
d90f34a479 [stdlib] RawOptionSetType : BitwiseOperationsType
Add the missing conformance now that Jordan implemented allZeros.

Swift SVN r20625
2014-07-28 15:52:45 +00:00
Dmitri Hrybenko
f75968d9cd stdlib: add a trap() function that traps in debug and release modes
rdar://17792445


Swift SVN r20620
2014-07-28 11:30:42 +00:00
Dmitri Hrybenko
ca07053adc stdlib: rename fatalError() to debugTrap()
Part of rdar://17792445


Swift SVN r20619
2014-07-28 11:14:52 +00:00
Doug Gregor
0b802ce6e9 String: add some unavailable subscript overloads for String with integer (or integer range) indices.
The compiler's QoI for these cases is horrible, and it's a common
pitfall, so be more direct about the fact that this cannot be done.


Swift SVN r20613
2014-07-28 03:50:26 +00:00
Dave Abrahams
31d6f95452 [stdlib] UnsafeBufferPointer: add ".count"
In answering a forum post I noiced that I wanted this and it was
missing.

Also, extensive comments

Also, rename the length: init parameter to count:.  When writing the
comments for the init function it became painfully clear why we use
"count" is better than "length" especially around pointers and memory:
the former is much less easy to mistake for "length in bytes".  Plus
it's consistent with the new ".count" property

Swift SVN r20609
2014-07-28 01:03:09 +00:00
Dmitri Hrybenko
06a9ea552c stdlib/String: fix hasPrefix() and hasSuffix() to perform proper Unicode
comparison

rdar://17498444


Swift SVN r20603
2014-07-27 18:12:02 +00:00
Dmitri Hrybenko
a4c1ef90e7 stdlib/Algorithm: add an overload for startsWith that accepts a
comparison predicate

Swift SVN r20601
2014-07-27 01:00:26 +00:00
Joe Groff
61f64f3323 stdlib: Add a '??' nil-coalescing operator.
Similar to nil-coalescing operators in other languages, this operator takes an optional on the left and a non-optional expression on the right, and if the optional is nil, evaluates the right side, otherwise returning the value from the optional itself. <rdar://problem/15247356>

Swift SVN r20593
2014-07-26 19:48:50 +00:00