Commit Graph

455 Commits

Author SHA1 Message Date
Dmitri Hrybenko
ca07053adc stdlib: rename fatalError() to debugTrap()
Part of rdar://17792445


Swift SVN r20619
2014-07-28 11:14:52 +00:00
Dmitri Hrybenko
729266205d stdlib: mark Float.value as private
Swift SVN r20590
2014-07-26 19:48:03 +00:00
Dmitri Hrybenko
ed855afb68 stdlib/String: use the Unicode collation algorithm in String's and Character's conformance to Comparable
rdar://17498444


Swift SVN r20554
2014-07-25 18:32:36 +00:00
Doug Gregor
681059a089 Make CGFloat conform to Strideable but not RandomAccessIndex.
This brings CGFloat into line with changes recently made to the other
floating-point types. <rdar://problem/17758020>

Swift SVN r20548
2014-07-25 17:17:18 +00:00
Doug Gregor
505674484b Allow construction of CGFloat from the sized Int/UInt types and vice-versa.
Fixes <rdar://problem/17670817> (+ dupes).
Notably, we were also missing a UInt(CGFloat) initializer, which

Swift SVN r20547
2014-07-25 16:56:47 +00:00
Dmitri Hrybenko
aa929798d0 stdlib: eliminate an inconsistent overload of == on NSString that would
make == and != inconsistent in non-generic code, and that would not be
used at all in generic code.

Part of rdar://17498444

Swift SVN r20524
2014-07-24 22:38:41 +00:00
Doug Gregor
d3012a0c26 Replace an 'override' with a 'required' for init(coder:).
Swift SVN r20496
2014-07-24 17:01:03 +00:00
Doug Gregor
5fc8ac7fd1 Require the 'override' keyword for initializers that override designated initializers.
Swift SVN r20490
2014-07-24 15:38:33 +00:00
Dave Abrahams
d00e888d95 [stdlib] Rename reinterpretCast => unsafeBitCast
Also give unsafeBitCast an explicit type parameter.  So

  let x: T = reinterpretCast(y)

becomes

  let x = unsafeBitCast(y, T.self)

Swift SVN r20487
2014-07-24 13:17:36 +00:00
Dmitri Hrybenko
89420772a2 stdlib/String: move enough bridging machinery into the core standard
library so that core library can bridge a String to Objective-C

Part of rdar://17498444

Swift SVN r20485
2014-07-24 13:07:12 +00:00
Dave Abrahams
1a7648b04b [stdlib] String.stringWithBytes: drop length param
The length could already be given by the input sequence.  Also, make it
accept any generic Sequence of bytes, rather than requiring an array.

Fixes <rdar://problem/17034413>

Swift SVN r20480
2014-07-24 08:23:10 +00:00
Doug Gregor
b1b6886fda Add missing required initializers to _NSContiguousString and _NSOpaqueString.
Swift SVN r20449
2014-07-23 23:47:02 +00:00
Dave Abrahams
a3211d0d68 [stdlib] dynamic NSString.localizedStringWithFormat
It used to always construct an NSString; now it constructs the class it
was called through

Swift SVN r20439
2014-07-23 22:59:27 +00:00
Dmitri Hrybenko
766c9816de stdlib: underscore-prefix String.core
Swift SVN r20411
2014-07-23 16:28:57 +00:00
Doug Gregor
c2b5703865 API notes: rework CMake support so that we can separate the API notes sources.
Move all of the information about API notes into the "apinotes"
subdirectory, which specifies the API notes that it provides. The
organization is such that "apinotes" can become its own separate
repository, and the compiler build will pick up those API notes that
are available and build them along with the overlays.

Swift SVN r20406
2014-07-23 16:09:49 +00:00
Dmitri Hrybenko
d168ad3d13 stdlib: don't use Builtin types in public APIs, this is quite pointless
Swift SVN r20392
2014-07-23 13:05:37 +00:00
Dave Abrahams
00f9ca5eda [stdlib] Rename [_]elementStorage=>[_]baseAddress
Swift SVN r20342
2014-07-22 22:29:03 +00:00
Dave Abrahams
1438d617cd [stdlib] Rename ConstUnsafePointer=>UnsafePointer
Swift SVN r20318
2014-07-22 17:10:54 +00:00
Dave Abrahams
21669b3aee [stdlib] Add "Mutable" to [Autoreleasing]UnsafePointer
UnsafePointer becomes UnsafeMutablePointer
AutoreleasingUnsafePointer becomes AutoreleasingUnsafeMutablePointer

Swift SVN r20316
2014-07-22 16:56:23 +00:00
Dmitri Hrybenko
d14f17beef Change 'getLogicValue()' into a property 'boolValue'; change
'getArrayBoundValue()' into a property 'arrayBoundValue'.

rdar://17156123


Swift SVN r20304
2014-07-22 12:08:10 +00:00
Dave Abrahams
2c3ab47cf2 [stdlib] O(1) Array<non-verbatim> round-tripping
Arrays of non-verbatim-bridged types (such as Int, and today's String)
are converted to Objective-C lazily, with the objects created due to
element conversion being autoreleased when necessary.

Fixes <rdar://problem/17360154>

Note: test/SIL/Parser/array_roundtrip.swift was XFAIL'd;
see <rdar://problem/17758203>

Swift SVN r20293
2014-07-22 04:42:47 +00:00
Enrico Granata
c06a072270 After investigating, there is no actual reason why the SpriteKit mirrors had to be disabled on iOS. So, just do the right thing. One change, of course, is to use UIImage on-device instead of NSImage. Both can be built from an NSData, and according to purplefish, the NSData we get back is of the correct image format to be reconstructed on either platform. Fixes rdar://17593122
Swift SVN r20289
2014-07-22 01:37:01 +00:00
Joe Groff
436acb00f3 Foundation: Remove the prepareWithInvocationTarget overlay.
Giving the invocation target proxy a type will be bogus when we turn on 'dynamic'. This breaks the NSUndoManager tests because we still can't work with lvalues through AnyObject. <rdar://problem/17755906>

Swift SVN r20283
2014-07-22 00:23:34 +00:00
Fariborz Jahanian
5197fe0f9d Move noErr to Darwin with OSStatus as its type.
rdar://17285288


Swift SVN r20279
2014-07-21 21:14:27 +00:00
Fariborz Jahanian
55e3e4b028 declare 'noErr' in the overlay to be of type Int32
(to make it compatible with OSStatus) rdar://17285288
This line, and those below, will be ignored--

M    stdlib/objc/Foundation/Foundation.swift


Swift SVN r20278
2014-07-21 20:43:55 +00:00
Fariborz Jahanian
ff02defe06 Adding "typealias NSRectEdge = CGRectEdge" in the
overlay. rdar://16593744


Swift SVN r20269
2014-07-21 19:06:35 +00:00
Doug Gregor
b502010365 s/auto_closure/autoclosure in XCTest
Swift SVN r20255
2014-07-21 15:36:57 +00:00
Doug Gregor
4c49802c15 Drop the ~= overload for NSObject <rdar://problem/17639977>.
Swift SVN r20254
2014-07-21 15:32:06 +00:00
Doug Gregor
eed37dc92e Remove bridging of NSPoint, NSSize, and NSRect because they are OSX-only.
This effectively reverts all but the NSRange part of r20241, because
it's better to have consistent behavior across the platforms than have
this feature on just one platform.

Swift SVN r20252
2014-07-21 15:13:37 +00:00
Dave Abrahams
8091436114 [stdlib] Bridge the types NSValue wraps explicitly
NSRange, NSPoint, NSSize, and NSRect.  This time, using Jordan's
suggestion for iOS portability.

Fixes <rdar://problem/16973060>


Conflicts:
	stdlib/objc/Foundation/CMakeLists.txt
	stdlib/objc/Foundation/Foundation.swift

Swift SVN r20241
2014-07-21 04:18:40 +00:00
Ben Langmuir
9c267d5dc7 Add some missing cmake dependencies
The only interesting bit is that for stdlib/objc to build reliably, its
.o files all need to depend on the generated swiftmodule files for any
of its library dependencies.  It looks like cmake treats
target_link_libraries as only implying a dependency between the
resulting libraries, and not the objects.  For now, I've achieved this
by making the objects depend on the whole target (which includes
linking), but only the swiftmodule is actually necessary.

Swift SVN r20240
2014-07-21 04:07:50 +00:00
Jordan Rose
8f520414b7 [Accessibility] A private class cannot contain public methods.
There's no meaningful way in which these methods are public, since they
can't be accessed through any value of the type

<rdar://problem/17647878>

Swift SVN r20224
2014-07-20 17:26:24 +00:00
Ted Kremenek
3075dee511 Mark 'NSConstantString' unavailable. Implements <rdar://problem/17306671>.
Swift SVN r20208
2014-07-19 05:14:06 +00:00
Dave Abrahams
ac1a050732 [stdlib] make some bridging classes final
Swift SVN r20186
2014-07-18 22:07:07 +00:00
Enrico Granata
7bf01a5caf Add a Mirror for NSCursor. This should be the last Cocoa Mirror that we need to write for this release - barring any last-minute critical incoming. Fixes rdar://16681585
Swift SVN r20160
2014-07-18 18:01:45 +00:00
Doug Gregor
716d548806 Start generating .apinotes files for each of the frameworks that have them.
.apinotes files provide API annotations alongside the Swift overlays
for Objective-C modules, and will be handled by the Clang
importer. Start generating these files from the current in-compiler
source (KnownObjCMethods.def).

The eventual goal is to switch from KnownObjCMethods.def to the
currently-being-defined textual format for API notes, and to replace
the silly swift-ide-test invocations with a Swift driver mode.


Swift SVN r20085
2014-07-17 14:34:20 +00:00
Dmitri Hrybenko
4c4f83fb52 stdlib: underscore-prefix requirements of _BridgedToObjectiveCType and
_ConditionallyBridgedToObjectiveCType protocols

rdar://17283639


Swift SVN r20079
2014-07-17 09:42:19 +00:00
Chris Hanson
877367add5 Have XCTest use string interpolation everywhere.
Instead of using reflect(), use string interpolation now that it should work everywhere.

Addresses <rdar://problem/17415068>.

Swift SVN r20061
2014-07-16 23:58:07 +00:00
Dmitri Hrybenko
f04a37ffd3 stdlib: make NSDictionary.Generator initializer private (users should call
NSDictionary.generate())


Swift SVN r20022
2014-07-16 09:05:22 +00:00
Dmitri Hrybenko
d9d789f418 stdlib: rename NSDictionaryGenerator to NSDictionary.Generator
rdar://17674077


Swift SVN r20021
2014-07-16 08:59:37 +00:00
Chris Hanson
c3c1489a1c Declare access control for XCTest overlay.
Now that Swift has an access control model, we need to apply it to the XCTest overlay.

This is handy in that it lets us hide some implementation details of the overlay.

Addresses <rdar://problem/17653535>.

Swift SVN r19989
2014-07-15 23:03:29 +00:00
Enrico Granata
e67251392e Now that CGFloat is a struct, it needs to be reflected separately. We can still just reflect its native buffer, but an explicit Reflectable conformace is required. Fixes rdar://17682337
Swift SVN r19984
2014-07-15 20:42:08 +00:00
Chris Lattner
e0b0205cd7 Remove the @assignment attribute entirely. It doesn't do anything except
enforce its own little constraints.  The type checker isn't using it for
anything, and it is just clutter.

This resolves <rdar://problem/16656024> Remove @assignment from operator implementations



Swift SVN r19960
2014-07-14 22:44:25 +00:00
Doug Gregor
71cd9245ba Rename swift_stdlib_core -> swiftCore and swift_runtime -> swiftRuntime.
We can't use underscores in plists, so just makes the names consistent
<rdar://problem/17652418>.

Swift SVN r19954
2014-07-14 22:19:03 +00:00
Chris Lattner
8991456ff2 Switch infix/postfix/prefix to be declaration modifiers instead of attributes,
eliminating the @'s from them when used on func's.  This is progress towards
<rdar://problem/17527000> change operator declarations from "operator prefix" to "prefix operator" & make operator a keyword

This also consolidates rejection of custom operator definitions into one
place and makes it consistent, and adds postfix "?" to the list of rejected
operators.

This also changes the demangler to demangle weak/inout/postfix and related things
without the @.



Swift SVN r19929
2014-07-14 15:51:49 +00:00
Dave Abrahams
d85a7f5d0c [stdlib] Pointer types are not BooleanType's
Fixes <rdar://problem/17597917>.  Someone still needs to do this for the
Optional types.

Swift SVN r19901
2014-07-13 19:21:54 +00:00
Dmitri Hrybenko
45f9706c22 stdlib/Dictionary: remove 'public' from more Dictionary implementation details
Swift SVN r19898
2014-07-13 12:21:20 +00:00
Dmitri Hrybenko
08d6650828 stdlib/Dictionary: move implementation of Dictionary.bridgeToObjectiveC() from
Foundation overlay to core stdlib, and remove 'public' from some Dictionary
implementation details


Swift SVN r19897
2014-07-13 11:51:23 +00:00
Dave Abrahams
bf55e6b4ed [stdlib] s/FloatingPointNumberType/FloatingPointType/
Swift SVN r19887
2014-07-13 01:00:51 +00:00
Dave Abrahams
cbcf9aba21 s/LogicValueType/BooleanType/
We're moving toward using that protocol for straight-up Bool types

Swift SVN r19884
2014-07-12 18:58:18 +00:00