Commit Graph

3245 Commits

Author SHA1 Message Date
Max Moiseev
b1898ab768 Porting String APIs to Subtring and fixing some tests 2017-04-25 14:58:06 -07:00
Maxim Moiseev
13abb9a0a7 [stdlib] BinaryInteger func word(at:) => var words: Words (#8984)
* [stdlib] Underscoring BinaryInteger.word(at:)

* [stdlib] Implementing var words in terms of _word(at:)
2017-04-25 08:45:01 -07:00
Michael Ilseman
2d8164e552 [stdlib] Parse my tweets faster! 2x forwards, 3x reverse
Adds in a special case grapheme break detection between two values
within scalar ranges where we have special knowledge. Any sub-0x300
scalars, except CR-LF, are guaranteed to have grapheme breaks between
them. We're reasonably confident this will not change in future
versions of Unicode. We might add more ranges in the future, but
should do so conservatively, anticipating future Unicode changes.

In these cases we can very quickly break, even for strings that have
mixed latin and emoji characters. In a ASCII string with a single
emoji in it, we traverse the string 2x faster forwards and 3x faster
in reverse. (Reverse is 3x faster as it involves some forwards
traversal inside of the index). For a string that's half Latin half
non-Latin, we're about 1.5x faster forwards and backwards.
2017-04-24 15:17:25 -07:00
Jordan Rose
25985cb764 [Mangling] Uniformly use "So" for imported decls.
...and repurpose "SC" for (C)lang-importer-synthesized decls, instead
of just decls that are C-like instead of ObjC-like. (See next commits.)
2017-04-24 09:57:30 -07:00
Maxim Moiseev
1c1b2b966d [stdlib] String : RangeReplaceableCollection & BidirectionalCollection (#8921)
* [stdlib] String : RangeReplaceableCollection & BidirectionalCollection

* Add source compatibility hack for Swift.max

* Add source compatibility hack for Swift.min

* Remove redundant conformance in benchmarks

* Fix stupid typo I thought I'd already pushed

* XFAIL testing now-redundant conformance

* XFAIL an IDE test for now
2017-04-23 20:04:54 -07:00
Ted Kremenek
01e09036e1 baseAddress is optional. 2017-04-22 22:21:05 -07:00
Ted Kremenek
81b00d46ab These tests explicitly need -swift-version 3.
These tests included sources that are
based on Swift 3.  They can be considered to be updated later to Swift 4, but it did not seem critical for what they were testing.
2017-04-22 22:15:15 -07:00
Erik Eckstein
d2da58363d Disabled KeyPath tests, because they are failing on many bots
rdar://problem/31776015
2017-04-22 19:08:39 -07:00
Joe Groff
3d178be169 Merge pull request #8875 from jckarter/keypaths
Keypaths
2017-04-21 17:51:17 -07:00
Joe Groff
d5cdf658da KeyPaths: Generate _kvcKeyPathString for ObjC-compatible keypaths. 2017-04-21 16:56:17 -07:00
Michael Ilseman
659260d5a0 Merge pull request #8870 from milseman/string_character_iteration
[stdlib] Speed up char iteration on ASCII strings.
2017-04-21 11:48:55 -07:00
swift-ci
42c150cfb7 Merge pull request #8900 from DougGregor/lazy-filter-index 2017-04-20 17:31:19 -07:00
Erik Eckstein
43ecc02397 Disable a failing test.
rdar://problem/31746923
2017-04-20 16:44:45 -07:00
Michael Ilseman
8b5777fdd2 [stdlib] Bug fix in reverse ASCII grapheme breaking
Fix a bug using wrong index calculations in the ASCII grapheme
breaking fast path. Add new test case.
2017-04-20 16:22:18 -07:00
Doug Gregor
70ee642072 [Stdlib] Eliminate LazyFilterIndex.
Eliminate the vestigial type `LazyFilterIndex`, which was
necessary pre-Swift-3 to allow the index to move. Swift 3's indexing
model means that the movement of indices is on the collection itself,
so we no longer need `LazyFilterIndex`: instead, the `Index` type of
the lazy filtered collection is simply the `Index` type of the base
collection, which is a nice convenience: it means you can take indices
from a lazy wrapper around a given collection C and use them with the
collection C (and, with care, vice-versa) without jumping through
extra hoops.
2017-04-20 16:15:41 -07:00
Philippe Hausler
fa39edf6a0 Account for floating point exactly conversions and disable some tests that are caused by SR-4634 2017-04-20 13:34:04 -07:00
swift-ci
1d46e688db Merge pull request #8510 from phausler/data_slice_fixes 2017-04-20 12:12:16 -07:00
Joe Groff
c742f88434 Work around a bug in the closure specializer with methods that return Self and take closure arguments (rdar://problem/31725007) 2017-04-20 08:53:55 -07:00
Joe Groff
517c45aa3d Followups from merging master 2017-04-19 20:58:52 -07:00
Joe Groff
cdb54ccadf Put keypaths behind a flag. 2017-04-19 20:39:11 -07:00
Joe Groff
595e0e4ede Merge branch 'master' into keypaths 2017-04-19 18:38:24 -07:00
Joe Groff
e9f70732a6 Mark execution tests for keypaths with PTRSIZE=64 requirement.
Landing 32-bit support requires some additional work, and relies on Greg finalizing the 8-byte rc header.
2017-04-19 18:23:46 -07:00
swift-ci
20dcfcb425 Merge pull request #8860 from moiseev/unsigned-minus-one 2017-04-19 11:50:53 -07:00
Max Moiseev
830b2edf54 [stdlib] Check overflow in integer init from literal
Fixes: <rdar://problem/29911715>
And partially: <rdar://problem/29937936>
2017-04-19 11:06:26 -07:00
Joe Groff
a6cd471c2b IRGen/stdlib: Instantiate non-generic computed key path components. 2017-04-18 21:51:12 -07:00
practicalswift
a029589093 [gardening] Use consistent headers 2017-04-18 19:51:08 +02:00
Philippe Hausler
138644f1e3 [Foundation] Add unit tests for unconditional bridging and import a few unit tests for Decimal 2017-04-18 10:09:39 -07:00
Joe Groff
0bb83bb185 KeyPaths: Support out-of-place instantiation of generic key paths. 2017-04-17 22:36:26 -07:00
Philippe Hausler
d26970e77a Validate the exactly pattern of Double from NSNumber to ensure proper IEEE 754 non lossy conversions 2017-04-17 17:19:20 -07:00
Philippe Hausler
24469a9512 [Foundation] NSNumber bridging and Numeric types (SE-0170) 2017-04-17 15:01:02 -07:00
Max Moiseev
8ca814cc8c Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-04-17 14:40:20 -07:00
swift-ci
c158056d1e Merge pull request #8559 from phausler/enumerate_bytes_index 2017-04-17 11:08:14 -07:00
Max Moiseev
9b53efd72c Merge branch 'master' into new-integer-protocols 2017-04-17 09:53:44 -07:00
Max Moiseev
2e67c13d15 Fixing some tests 2017-04-14 16:19:06 -07:00
Max Moiseev
fbc980947c Splitting the MixedTypeArithmeticsDiagnostics test into two (Swift 3 and Swift 4) 2017-04-14 11:57:35 -07:00
practicalswift
98838a1a6f [gardening] Use consistent headers 2017-04-14 17:35:37 +02:00
Erik Eckstein
789646a15b Demangling: Make demangled names more readable and further reduce the size of the simplified demangled names
The goal here is to make the short demangling as short and readable as possible, also at the cost of omitting some information.
The assumption is that whenever the short demangling is displayed, there is a way for the user to also get the full demangled name if needed.

*) omit <where ...> because it does not give useful information anyway

Deserializer.deserialize<A where ...> () throws -> [A]
--> Deserializer.deserialize<A> () throws -> [A]

*) for multiple specialized functions only emit a single “specialized”

specialized specialized Constructible.create(A.Element) -> Constructible<A>
--> specialized Constructible.create(A.Element) -> Constructible<A>

*) Don’t print function argument types:

foo(Int, Double, named: Int)
--> foo(_:_:named:)

This is a trade-off, because it can lead to ambiguity if there are overloads with different types.

*) make contexts of closures, local functions, etc. more readable by using “<a> in <b>” syntax
This is also done for the full and not only for the simplified demangling.

Renderer.(renderInlines([Inline]) -> String).(closure #1)
--> closure #1 in Renderer.renderInlines

*) change spacing, so that it matches our coding style:

foo <A> (x : A)
--> foo<A>(x: A)
2017-04-13 08:43:28 -07:00
Max Moiseev
f106bd9529 Running new integer tests in Swift 4 mode only 2017-04-12 17:03:46 -07:00
Max Moiseev
0478c06f6a Removing obsolete rename tests 2017-04-12 14:51:04 -07:00
Dave Abrahams
1f7ec57b04 Merge pull request #1527 from codestergit/master
[Stdlib] Improves Collection.sort  to accept throwing closure
2017-04-11 18:03:17 -07:00
Max Moiseev
a3a3351bd8 Merge branch 'master' into new-integer-protocols 2017-04-10 15:41:13 -07:00
Greg Parker
cfee4d9c5e [runtime] Fix some casts of _SwiftValue (#8457)
* [runtime] Fix some casts of _SwiftValue.

* Allow _SwiftValue to be cast to NSObject by yielding the box object itself.
* Failed casts from NSDictionary containing _SwiftValue should not crash.

SR-4306, rdar://31197066
2017-04-10 14:31:35 -07:00
Joe Groff
39a0849362 SILGen: Codegen for key path applications. 2017-04-09 16:38:34 -07:00
Daniel Duan
ddfe7e814e Merge pull request #8406 from dduan/bridgenonverbatim_unittest
Test: use StdlibUnittest in BridgeNonVerbatim
2017-04-07 18:04:03 -07:00
Max Moiseev
022665547b Merge branch 'master' into new-integer-protocols 2017-04-07 14:42:53 -07:00
Andrew Trick
0f3896ba9c Reenable some raw buffer tests in release build.
These subtests were actually meant to test the raw buffer
type itself, not its slice type. So adding an `init(rebasing:)`
does what we want.

Now that the Collection tests are wired up, these test cases will be run on the
slice type automatically. No need to do it here.
2017-04-07 11:50:02 -07:00
Andrew Trick
0bf46a89cc Temporarily disable some debug-assert tests in the release build.
Some build configurations seem to be unexpectedly crashing even
in "release" mode. I'm not sure yet why they're hitting an assert.

These sub-tests are affected:
["subscript.get.underflow", "subscript.get.overflow",
 "subscript.set.underflow", "subscript.set.overflow",
 "subscript.range.get.underflow", "subscript.range.get.overflow",
 "subscript.range.set.underflow", "subscript.range.set.overflow"]
2017-04-07 00:45:01 -07:00
Joe Groff
85ad6b355e Merge branch 'master' into keypaths 2017-04-06 18:02:07 -07:00
Andrew Trick
8668f9bd72 Add init(rebasing:) to UnsafeBufferPointer.
This is required for consistency with UnsafeRawBufferPointer.
2017-04-06 17:12:18 -07:00
Andrew Trick
c12740a8a2 Add UnsafeRawBuffer(rebasing:) initializers.
Allows converting a raw slice into a zero-based raw buffer,
which is a common operation on flat memory.

Add and update UnsafeRawBufferPointer unit tests.
2017-04-06 17:12:18 -07:00