Commit Graph

62 Commits

Author SHA1 Message Date
Joe Pamer
1d34a88477 Revert "Fix two problems with implicit conversions: - rdar://problem/16776273, wherein conversions between nil and .None were permitted due to an implicit conversion between nil and COpaquePointer. - rdar://problem/16877526, where we needed to add new equality overloads to handle conversions between nil and .None given the supression of user conversions. (Thanks to Ted for the overloads and test.)"
This reverts commit r18473.

Swift SVN r18477
2014-05-21 00:28:46 +00:00
Joe Pamer
f469d8f1f6 Fix two problems with implicit conversions:
- rdar://problem/16776273, wherein conversions between nil and .None were permitted
due to an implicit conversion between nil and COpaquePointer.
- rdar://problem/16877526, where we needed to add new equality overloads to handle
conversions between nil and .None given the supression of user conversions.
(Thanks to Ted for the overloads and test.)

Swift SVN r18473
2014-05-20 23:53:34 +00:00
Arnold Schwaighofer
da6d9152b6 Differentiate between user assertion and preconditions and the like
assert() and fatalError()
These functions are meant to be used in user code. They are enabled in debug
mode and disabled in release or fast mode.

_precondition() and _preconditionFailure()
These functions are meant to be used in library code to check preconditions at
the api boundry. They are enabled in debug mode (with a verbose message) and
release mode (trap). In fast mode they are disabled.

_debugPrecondition() and _debugPreconditionFailure()
These functions are meant to be used in library code to check preconditions that
are not neccesarily comprehensive for safety (UnsafePointer can be null or an
invalid pointer but we can't check both). They are enabled only in debug mode.

_sanityCheck() and _fatalError()
These are meant to be used for internal consistency checks. They are only
enabled when the library is build with -DSWIFT_STDLIB_INTERNAL_CHECKS=ON.

I modified the code in the standard library to the best of my judgement.

rdar://16477198

Swift SVN r18212
2014-05-16 20:49:54 +00:00
Dmitri Hrybenko
2c1715fe78 stdlib/Dictionary: address internal API review: preallocate storage when
creating a Dictionary from a dictionary literal

Also fixes rdar://16876745, because once the code moved to using lower-level
interfaces, it became trivial to detect duplicate keys without a performance
hit.


Swift SVN r18193
2014-05-16 14:41:03 +00:00
Enrico Granata
8478cd9905 Add a mirror for NSSet
Part of the playgrounds effort



Swift SVN r18038
2014-05-13 23:20:32 +00:00
Doug Gregor
d5a9c2ab94 Only supersede initializers with other imported initializers when the types match.
This fixes a case where the Swift-variadic and C-varargs versions of
various initializers were superseding each other
<rdar://problem/16801456>.

It also uncovered some more cases where we weren't getting quite the
right semantics for factory-methods-as-initializers, which are also
fixed here.

Swift SVN r18010
2014-05-13 16:49:39 +00:00
Dmitri Hrybenko
2cc8fe40d4 stdlib/printing: replace four printing systems with one new one
The old ones were:

- print/println
- printAny
- printf
- Console

The new printing story is just print/println.  Every object can be printed.
You can customize the way it is printed by adopting Printable protocol.  Full
details in comments inside stdlib/core/OutputStream.swift.

Printing is not completely finished yet.  We still have ReplPrintable, which
should be removed, string interpolation still uses String constructors, and
printing objects that don't conform to Printable will result in printing
mangled names.


Swift SVN r18001
2014-05-13 13:07:59 +00:00
Doug Gregor
cdf98aa8ea The bang is also unnecessary
Swift SVN r17995
2014-05-13 04:21:29 +00:00
Chris Lattner
09ec8091d5 hopefully fix a test on the buildbot.
Swift SVN r17993
2014-05-13 03:46:45 +00:00
Doug Gregor
73528dc0e0 Enable importing factory methods as initializers by default.
Finishes <rdar://problem/16509024>.

Swift SVN r17972
2014-05-12 23:01:20 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Joe Groff
73e564428f stdlib/runtime: Stub out a mechanism for introspecting value structure.
Define a "Mirror" protocol with methods for querying the number of children a structured value has, getting the name and mirror for each of those children, and a string and "IDE representation" of the value, as needed by playgrounds and by our planned generic printing facility.

In the runtime, define a "reflect" function that can provide a Mirror for any object, either using a "Reflectable" protocol conformance if available, or falling back to a magic implementation in the runtime that grovels the type metadata. Stub out a bare minimum default implementation.

Swift SVN r14139
2014-02-20 08:26:27 +00:00