Commit Graph

3245 Commits

Author SHA1 Message Date
Dmitri Hrybenko
fcb7d40f99 StdlibUnittest: move expectType() predicate to the library
Swift SVN r22416
2014-10-01 01:12:11 +00:00
Dave Abrahams
c93f32a4b3 [stdlib] Eliminate needless intermediate class
Swift SVN r22415
2014-09-30 23:43:25 +00:00
Dave Abrahams
156020de19 [stdlib] Rename 'countElements' => 'count'
The name was not only long and unwieldy, but inconsistent with our
conscious decision to avoid the use of "elements" in APIs as mostly
redundant.

Swift SVN r22408
2014-09-30 22:00:26 +00:00
Dave Abrahams
7f0439b90a [stdlib] Disable one more mixed-sign case
Also update release notes

Swift SVN r22403
2014-09-30 21:25:03 +00:00
Dave Abrahams
41359fb128 [stdlib] Disallow mixed-sign arithmetic
It was unintentionally possible to add an Int to any
UnsignedIntegerType.  Use an intentional ambiguity to prevent that at
compile-time.

Swift SVN r22402
2014-09-30 20:21:01 +00:00
Dave Abrahams
d8122fd010 [testing] Purge use of mixed-sign arithmetic
Swift SVN r22401
2014-09-30 20:21:00 +00:00
Dmitri Hrybenko
4f38403eda stdlib: fix bugs in StaticString.isASCII and add tests
rdar://18301485 rdar://18139547

Swift SVN r22356
2014-09-29 16:07:18 +00:00
Dmitri Hrybenko
cca52dfefe Fix ArrayNew test
Writeback behavior in this test is more complicated than I originally
thought.

rdar://18461064

Swift SVN r22351
2014-09-29 13:17:38 +00:00
Dmitri Hrybenko
dd7c153101 Disable problematic check in ArrayNew test; I did not intend to commit this
Swift SVN r22308
2014-09-27 00:34:02 +00:00
Dmitri Hrybenko
a04ee3a463 stdlib/Unicode: allow transcode() to operate on mutable value-typed
sinks

Swift SVN r22302
2014-09-26 17:28:00 +00:00
Joe Groff
9eb4f5b512 SILGen: Use Array._allocateUninitialized to form array literals.
This avoids a pointless copy every time an array literal is written, and will let us retire the horrible "alloc_array" instruction and globs of broken IRGen code. Implements rdar://problem/16386862, and probably fixes a bunch of bugs related to alloc_array brokenness.

Swift SVN r22289
2014-09-25 22:26:20 +00:00
Dmitri Hrybenko
4b5d80a0eb Try to stabilize ArrayNew test by making it resilient to memory
allocator implementation details

This test could fail if Array storage was reallocated twice, and the
last time the storage was allocated at the same address as initially.

Swift SVN r22280
2014-09-25 11:12:56 +00:00
Dmitri Hrybenko
4138fa5d6b stdlib: add a test for Array of enum values
Swift SVN r22279
2014-09-25 09:56:01 +00:00
Dmitri Hrybenko
e7a08eca82 Remove dead code from ArrayNew test
Swift SVN r22277
2014-09-25 09:55:50 +00:00
Dmitri Hrybenko
42b9bf3e28 stdlib: use addressors in {ContiguousArray,Slice}.subscript(_: Int)
Swift SVN r22265
2014-09-24 14:38:23 +00:00
Dmitri Hrybenko
1e7f0f8b39 Add tests for printing metatypes
Swift SVN r22260
2014-09-24 10:05:43 +00:00
Dmitri Hrybenko
f6fb506bb5 stdlib: 'internal'ise an initializer
Swift SVN r22259
2014-09-24 09:15:19 +00:00
Dave Abrahams
a9897a1aa1 [stdlib] Don't test internal APIs in validation
Swift SVN r22190
2014-09-22 22:24:07 +00:00
Anna Zaks
505257ae9b API Notes: This contains audit for most of AppKit!
Plus, smaller enhancements on the other frameworks.
Removes the need for _PrintableNSObjectType hack (rdar://problem/16883288)

Swift SVN r22185
2014-09-22 21:47:22 +00:00
Doug Gregor
df33350219 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. r22176 eliminated the performance penalty
that prevented this change from sticking earlier.



Swift SVN r22177
2014-09-22 20:17:55 +00:00
Doug Gregor
55afb33c94 Associate argument labels with the callee in the solver.
When performing name lookup for a declaration that is being called,
use the argument labels at the call site to filter out those
declarations with incompatible argument labels.


Swift SVN r22176
2014-09-22 20:08:01 +00:00
Dave Abrahams
5d519a647c [stdlib] Minor fixups for r22152
Thanks for the review, Dmitri!

Swift SVN r22174
2014-09-22 16:49:04 +00:00
Dmitri Hrybenko
a5d2f81a33 Add tests for _canBeClass
Swift SVN r22169
2014-09-22 12:54:50 +00:00
Dmitri Hrybenko
285464ef21 Test for _isClassOrObjCExistential: a Swift closure is not a class
Swift SVN r22168
2014-09-22 12:54:48 +00:00
Dmitri Hrybenko
7da858cf39 Add tests for _isClassOrObjCExistential()
Swift SVN r22167
2014-09-22 12:48:26 +00:00
Dave Abrahams
40e9a0f859 [stdlib] Fix memory safety with evil collections
A collection whose count changes between traversals could cause a memory
safety problem, as we would measure the collection in one pass and
assume that it was the same length when actually initializing array
elements.  Fix that by always using the initial measurement, which
corresponds exactly to allocated memory.  If the collection wants to
trap because we've gone past its new bounds, that's fine.  If it
doesn't, at least we haven't done anything unsafe.

Swift SVN r22152
2014-09-20 03:35:23 +00:00
Dmitri Hrybenko
e35323bc98 Restore the expected autorelease count for 32-bit simulator in
ArrayNew test

Swift SVN r22142
2014-09-19 19:33:38 +00:00
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
Doug Gregor
f0d03efb4c Drastically restrict the set of alternative literal types checked by the solver.
When the solver has attempted to produce a solution using the default
literal type tha has failed, dont' try every type that conforms to
that literal type. Instead, try the bridged class type (which deals
with the common AnyObject case) or one of two other options:
  - For integer literals, try the default floating point type (Double)
  - For string literals, try the standard library's AssertString (this
  is a temporary hack)

This limits exponential blow-up in cases where the literal's type
cannot be determined from context. Addresses rdar://problem/18307267.



Swift SVN r22131
2014-09-19 16:22:21 +00:00
Dmitri Hrybenko
e78e620fea Remove debugging code from the ArrayNew test
Swift SVN r22129
2014-09-19 14:21:39 +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
Ben Langmuir
0098730b4e Temporarily disable the problematic check in ArrayNew test on armv7
Unfortunately it didn't only fail on arm64

<rdar://problem/18385128>

Swift SVN r22117
2014-09-19 03:40:02 +00:00
Dmitri Hrybenko
b63a754103 Temporarily disable the problematic check in ArrayNew test on arm64
rdar://18385128

Swift SVN r22106
2014-09-18 23:22:58 +00:00
Dmitri Hrybenko
310672b526 ArrayNew test: replace calls to _fixLifetime with calls to _blackHole,
which consumes the whole value, not just the address

Swift SVN r22093
2014-09-18 19:08:09 +00:00
Dmitri Hrybenko
7e0a6d6649 Fix ArrayNew.swift test on 32-bit simulator
rdar://18381403

Swift SVN r22092
2014-09-18 18:56:29 +00:00
Dmitri Hrybenko
9bf27a4b76 Fix Dictionary.swift test on 32-bit iOS simulator
rdar://18381378

Swift SVN r22085
2014-09-18 18:00:02 +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
Dmitri Hrybenko
b9aa760025 stdlib: add more tests for delayed Array bridging
Swift SVN r22077
2014-09-18 16:01:52 +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
b095339da7 stdlib/Array: implement delayed bridging
rdar://18191358

Swift SVN r22071
2014-09-18 13:46:39 +00:00
Doug Gregor
d42563291e Switch DictionaryLiteralConvertible over to an initializer requirement.
Swift SVN r22033
2014-09-17 19:42:31 +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
Dmitri Hrybenko
112c7a5e19 Revert "Dictionary test: fix for platforms that don't have return-autoreleased"
I don't know how this stale commit appeared in my git history.

Swift SVN r21994
2014-09-16 22:52:32 +00:00
Dmitri Hrybenko
eab09f99ed Dictionary test: fix for platforms that don't have return-autoreleased
optimization

Swift SVN r21990
2014-09-16 22:42:26 +00:00
Doug Gregor
4dca192b18 Switch IntegerLiteralConvertible over to initializers.
Swift SVN r21986
2014-09-16 21:59:15 +00:00
Anna Zaks
22b4dcda36 Create an overlay for ALAssetsLibrary:enumerateGroupsWithTypes which accepts ALAssetsGroup types.
This is a case of type mismatch due to the parameter type not being a proper
NS_OPTIONS enum. However, it crashes at runtime on 32 bit, so let's introduce an
overlay while waiting for the proper fix.

Addresses radar://18201112

Swift SVN r21957
2014-09-15 22:10:51 +00:00
Anna Zaks
ec46eefb2f Overload dispatch_get_global_queue to work with QOS_CLASS.. constants
Addresses radar://18272350

Swift SVN r21956
2014-09-15 22:10:50 +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