Commit Graph

1007 Commits

Author SHA1 Message Date
Doug Gregor
7764f64cf8 Simplify assertion machinery in the standard library.
This change includes a number of simplifications that allow us to
eliminate the type checker hack that specifically tries
AssertString. Doing so provides a 25% speedup in the
test/stdlib/ArrayNew.swift test (which is type-checker bound).

The specific simplifications here:
  - User-level
  assert/precondition/preconditionalFailure/assertionFailer/fatalError
  always take an autoclosure producing a String, eliminating the need
  for the StaticString/AssertString dance.
  - Standard-library internal _precondition/_sanityCheck/etc. always
  take a StaticString. When we want to improve the diagnostics in the
  standard library, we can provide a separate overload or
  differently-named function.
  - Remove AssertString, AssertStringType, StaticStringType, which are
  no longer used or needed
  - Remove the AssertString hack from the compiler
  - Remove the "BooleanType" overloads of these functions, because
  their usefuless left when we stopped making optional types conform
  to BooleanType (sorry, should have been a separate patch).



Swift SVN r22139
2014-09-19 17:56:50 +00:00
Dmitri Hrybenko
ae8c52969b StdlibUnittest: make testing return-autoreleased optimization reliable
On some platforms (for example, x86_64), the first call to
`objc_autoreleaseReturnValue` will always autorelease because it would
fail to verify the instruction sequence in the caller.  On x86_64
certain PLT entries would be still pointing to the resolver function,
and sniffing the call sequence would fail.

This change adds a "warmup" return-autoreleased sequence to the test
harness.

rdar://18385128

Swift SVN r22127
2014-09-19 14:06:57 +00:00
Dave Abrahams
b5680b24ae [stdlib] Document Stride protocols
Also flesh out some RandomAccessIndexType docs

Swift SVN r22103
2014-09-18 22:23:08 +00:00
Dave Abrahams
ee05987aee [stdlib] Document StaticString protocols
Swift SVN r22102
2014-09-18 21:52:19 +00:00
Dave Abrahams
5c85fa5b7d [stdlib] Document Reflection protocols
Swift SVN r22100
2014-09-18 21:15:39 +00:00
Dave Abrahams
2e6ac37f55 [stdlib] document RangeReplaceableCollection
Swift SVN r22098
2014-09-18 20:47:20 +00:00
Dave Abrahams
02ebcad780 [stdlib] document remaining Policy.swift protocols
Swift SVN r22088
2014-09-18 18:44:42 +00:00
Doug Gregor
82d7daf5fc Revert StringInterpolationConvertible back to class method requirements.
The initializer requirement is causing too much exponential behavior
in the constraint solver. We'll have to address that
first. Re-instating this change is tracked by rdar://problem/18381811.


Swift SVN r22080
2014-09-18 17:10:53 +00:00
Doug Gregor
f1e47a7b18 Switch string interpolation protocol over to initializer requirements.
With this, we're now using initializer requirements rather than
"convertFromXXX" requirements everywhere, addressing the rest of
rdar://problem/18154091.


Swift SVN r22078
2014-09-18 16:13:18 +00:00
Doug Gregor
3ebf5cb3da Switch the string literal protocols over to initializer requirements.
Swift SVN r22076
2014-09-18 15:48:42 +00:00
Dmitri Hrybenko
65fd550aa2 stdlib: remove Doxygen markup
Swift SVN r22074
2014-09-18 15:30:05 +00:00
Dmitri Hrybenko
4f735794e1 stdlib: add a radar reference to a fixme
Swift SVN r22073
2014-09-18 14:11:06 +00:00
Dmitri Hrybenko
b64f6a48fa stdlib: attach documentation comments to array types
Swift SVN r22072
2014-09-18 14:04:15 +00:00
Dmitri Hrybenko
b095339da7 stdlib/Array: implement delayed bridging
rdar://18191358

Swift SVN r22071
2014-09-18 13:46:39 +00:00
Dmitri Hrybenko
f9f3d26ee7 stdlib: improve comment
Swift SVN r22070
2014-09-18 12:41:18 +00:00
Dmitri Hrybenko
0e7e60b50b Remove stale comment
Swift SVN r22069
2014-09-18 11:42:41 +00:00
Dmitri Hrybenko
2475a4ea57 stdlib: mark _stdlib_AtomicInt class 'final'
Swift SVN r22067
2014-09-18 09:31:52 +00:00
Dmitri Hrybenko
188f14ee9c stdlib: fix warning about extraneous '_'
Swift SVN r22066
2014-09-18 09:22:37 +00:00
Dave Abrahams
cacec2666f [stdlib] doc-comment BitwiseOperationsType
Swift SVN r22056
2014-09-18 00:55:49 +00:00
Dave Abrahams
52dd5d1771 [stdlib] doc-comment more public protocols
covers part of Policy.swift

Swift SVN r22051
2014-09-18 00:08:52 +00:00
Dave Abrahams
657e6a92eb [stdlib] doc-comment some protocols
handles: Interval.swift.gyb, Join.swift, OutputStream.swift

Swift SVN r22050
2014-09-18 00:08:51 +00:00
Dave Abrahams
5ddf4dca53 [stdlib] doc-comment integer arithmetic protocols
Swift SVN r22043
2014-09-17 21:19:25 +00:00
Dave Abrahams
33bebac909 [stdlib] Boilerplate doc-comment wording change
Swift SVN r22042
2014-09-17 21:19:24 +00:00
Dave Abrahams
d206f6b0f8 [stdlib] Doc-comment floating point protocols
Swift SVN r22039
2014-09-17 21:02:52 +00:00
Dave Abrahams
713125fd41 [stdlib] doc-comment compiler protocols
Swift SVN r22038
2014-09-17 20:49:24 +00:00
Dave Abrahams
214c7bc0fd [stdlib] Correct some ReST markup
Swift SVN r22037
2014-09-17 20:44:07 +00:00
Dave Abrahams
8c803f7959 [stdlib] internal-ize CharacterLiteralConvertible
That, and _BuiltinCharacterLiteralConvertible, are not actually useful
without special hidden switches being passed to the compiler.  We don't
want to have to explain them to users.

Swift SVN r22036
2014-09-17 20:41:56 +00:00
Doug Gregor
d42563291e Switch DictionaryLiteralConvertible over to an initializer requirement.
Swift SVN r22033
2014-09-17 19:42:31 +00:00
Dave Abrahams
6a40e001e1 [stdlib] doc-comment collection protocols
Swift SVN r22028
2014-09-17 18:11:50 +00:00
Doug Gregor
3972316d25 Switch ArrayLiteralConvertible over to an initializer requirement.
Swift SVN r22024
2014-09-17 17:46:26 +00:00
Roman Levenstein
275b34a890 Fix a recently introduced performance regression on StdlibSort test, which happened because new sorted() implementation was using closures.
rdar://18336428

Swift SVN r22022
2014-09-17 14:50:21 +00:00
Argyrios Kyrtzidis
c4ed48520b [stdlib] Replace unicode quotes with ascii ones.
It is currently beneficial when displaying the interface in Xcode if it is free from non-ascii characters.

Swift SVN r22000
2014-09-17 02:40:45 +00:00
Dave Abrahams
ed36ddf74b [stdlib] Doc-comment index protocols
Swift SVN r21998
2014-09-16 23:37:32 +00:00
Dave Abrahams
a134fdeaed [stdlib] doc-comment integer protocols
Swift SVN r21993
2014-09-16 22:45:57 +00:00
Doug Gregor
6a19c1235e Convert FloatLiteralConvertible to initializers
Swift SVN r21992
2014-09-16 22:45:09 +00:00
Dmitri Hrybenko
fad578b304 stdlib: remove ArrayBonudType
Swift SVN r21991
2014-09-16 22:42:33 +00:00
Dave Abrahams
b05f2528f5 [stdlib] Drop redundant factory func requirement
All the integers already have an init() that will narrow from Max[U]Int.
This change is consistent with our general move from factories to
initializers.

Swift SVN r21988
2014-09-16 22:41:19 +00:00
Dave Abrahams
ed52a1063f [stdlib] doc-comment Collection.swift
Swift SVN r21987
2014-09-16 22:01:28 +00:00
Doug Gregor
4dca192b18 Switch IntegerLiteralConvertible over to initializers.
Swift SVN r21986
2014-09-16 21:59:15 +00:00
Doug Gregor
e23aa008e6 Switch CharacterLiteralConvertible over to an initializer requirement.
Swift SVN r21985
2014-09-16 21:59:11 +00:00
Doug Gregor
7f80e00d37 Swift NilLiteralConvertible to an initializer requirement
Swift SVN r21980
2014-09-16 20:43:35 +00:00
Dave Abrahams
f3d1e5f448 [stdlib] Miscellaneous comments and cleanups
Swift SVN r21979
2014-09-16 20:00:31 +00:00
Dmitri Hrybenko
e6e17ac7d4 stdlib: replace _CocoaArrayType with _SwiftNSArrayRequiredOverridesType
Swift SVN r21972
2014-09-16 12:53:00 +00:00
Dmitri Hrybenko
9b62c620a7 stdlib: remove implied default 'internal' access modifier
Swift SVN r21970
2014-09-16 11:14:38 +00:00
Dmitri Hrybenko
4cf865de73 stdlib: factor all _NSXXXBase classes to a single place
Swift SVN r21969
2014-09-16 11:13:06 +00:00
Dmitri Hrybenko
c756296373 stdlib/Array: annotate invalid bitcasts
Swift SVN r21968
2014-09-16 10:25:31 +00:00
Doug Gregor
d93eaed9f7 Switch BooleanLiteralConvertible over to an initializer requirement.
Conforming to BooleanLiteralConvertible now requires

  init(booleanLiteral: Bool)

rather than

  static func convertFromBooleanLiteral(value: Bool) -> Self

This posed a problem for NSNumber's conformance to
BooleanLiteralConvertible. A class needs a required initializer to
satisfy an initializer requirement, but one cannot add a required
initializer via an extension. To that end, we hack the Clang importer
to import NSNumber's initWithBool with the name

  init(booleanLiteral:)

and add back the expected init(bool:) initializer in the
overlay. These tricks make NSNumber even harder to subclass, but we
don't really care: it's nearly impossible to do well anyway, and is
generally a Bad Idea.

Part of rdar://problem/18154091.

Swift SVN r21961
2014-09-15 23:59:30 +00:00
Dmitri Hrybenko
03e2717f0a stdlib/Array: add bounds checks to NSSwiftArray.objectAtIndex()
rdar://18336202

Swift SVN r21945
2014-09-15 15:50:43 +00:00
Dmitri Hrybenko
df82379a65 stdlib/Array: add bounds checks in NSSwiftArray.getObjects()
rdar://18320164

Swift SVN r21943
2014-09-15 15:26:49 +00:00
Dmitri Hrybenko
cdbd3bae84 stdlib/Dictionary: remove workaround that is no longer needed
Swift SVN r21942
2014-09-15 14:08:56 +00:00