Commit Graph

2952 Commits

Author SHA1 Message Date
Maxim Moiseev
01e1a7bd52 LazyCollectionType => LazyCollectionProtocol 2015-12-09 17:16:22 -08:00
Maxim Moiseev
faf25c3c65 AnyCollectionType => AnyCollection 2015-12-09 17:16:04 -08:00
Maxim Moiseev
3ab5d18c6c CollectionType => Collection 2015-12-09 17:15:28 -08:00
Dmitri Gribenko
5a07f89297 Remove 'generator' from names of test functions and local variables 2015-12-09 17:15:11 -08:00
Dmitri Gribenko
4b1be0e78f removeAtIndex() => removeAt() 2015-12-09 17:15:01 -08:00
Dmitri Gribenko
2bec8ad732 Fix comment on _ArrayType.insert() 2015-12-09 17:14:53 -08:00
Dmitri Gribenko
df17ddbc9b init(count: Int, repeatedValue: Element) => init(repeating:count:)
Affected types: _ArrayType, Array, ArraySlice, ContiguousArray, Repeat,
String (initializers from Character and UnicodeScalar)
2015-12-09 17:14:37 -08:00
Dmitri Gribenko
d72b5ab575 func SequenceType.enumerate() => var SequenceType.enumerated 2015-12-09 17:13:21 -08:00
Maxim Moiseev
09a6913622 RangeReplaceableCollectionType => RangeReplaceableCollection 2015-12-09 17:13:08 -08:00
Maxim Moiseev
7e2466c14e CollectionType => Collection 2015-12-09 17:12:48 -08:00
Dmitri Gribenko
feacbc4433 Rename ErrorType to ErrorProtocol 2015-12-09 17:12:19 -08:00
Dmitri Gribenko
99d3f96c6d Rename IndexingGenerator to CollectionDefaultIterator 2015-12-09 17:12:07 -08:00
Dmitri Gribenko
1c0047829a Rename SequenceType.generate() to SequenceType.iterator() 2015-12-09 17:11:17 -08:00
Dmitri Gribenko
2cf172160c Rename SequenceType.Generator associated type to SequenceType.Iterator 2015-12-09 17:11:05 -08:00
Andrew Trick
35cb1afab8 Fix dynamic runtime casts of Optionals.
Fixes <rdar://23122310> Runtime dynamic casts...

This makes runtime dynamic casts consistent with language rules, and
consequently makes specialization of generic code consistent with an
equivalent nongeneric implementation.

The runtime now supports casts from Optional<T> to U. Naturally the
cast fails on nil source, but otherwise succeeds if T is convertible to
U.

When casting T to Optional<U> the runtime succeeds whenever T is
convertible to U and simply wraps the result in an Optional.

To greatly simplify the runtime, I am assuming that
target-type-specific runtime cast entry points
(e.g. swift_dynamicCastClass) are never invoked with an optional
source. This assumption is valid for the following reasons. At the
language level optionals must be unwrapped before downcasting (via
as[?!]), so we only need to worry about SIL and IR lowering.  This
implementation assumes (with asserts) that:

- SIL promotion from an address cast to a value casts should only happen
  when the source is nonoptional. Handling optional unwrapping in SIL
  would be too complicated because we need to check for Optional's own
  conformances. (I added a test case to ensure this promotion does not
  happen). This is not an issue for unchecked_ref_cast, which
  implicitly unwraps optionals, so we can promote those!

- IRGen lowers unchecked_ref_cast (Builtin.castReference) directly to
  a bitcast (will be caught by asserts).

- IRGen continues to emit the generic dynamicCast entry point for
  address-casts (will be caught by asserts).
2015-12-09 16:12:30 -08:00
Andrew Trick
a8a49afd9e Add Builtin.isOptional.
There was previously no way to detect a type that is nominally
Optional at runtime. The standard library, namely OutputStream, needs
to handle Optionals specially in order to cirumvent conversion to the
Optional's wrapped type. This should be done with conditional
conformance, but until that feature is available, Builtin.isOptional
will serve as a useful crutch.
2015-12-09 16:06:42 -08:00
Nadav Rotem
2b791e6336 Merge pull request #370 from pramodsharma403/ps-typo
Typo Fixed : implemention -> implementation
2015-12-08 21:41:24 -08:00
Pramod Sharma
05ba2f4dbc Typo Fixed : implemention -> implementation 2015-12-09 09:56:57 +05:30
Patrick Pijnappel
230e4a39e6 Merge guards in Zip2Generator
Removes the duplication of the guard body code
2015-12-09 14:03:02 +11:00
Patrick Pijnappel
e7fabae50c Fix comment 2015-12-09 13:56:18 +11:00
Patrick Pijnappel
a3d5af5cd3 Fix documentation
The parsing regex listed in String(_, radix:) is incorrect.
2015-12-09 11:24:39 +11:00
Chris Eidhof
6857b0c3d5 Simplify filter 2015-12-08 16:07:29 -05:00
Nadav Rotem
a652945d9a Revert "A small step towards removing C-style loops"
This reverts commit 0d001480a9.

The commit that changed the iteration style from c-based loops into for-each
loops caused major regressions in our string benchmarks. Arnold believes that we
are making a different inlining decision in the for-each loops. We should
reapply this patch after we fix the optimizer

The regression was detected in rdar://23776732.
2015-12-08 09:17:17 -08:00
Nadav Rotem
26be9b6443 Revert "stdlib: simplify code"
This reverts commit 403b46ccea.
2015-12-08 09:12:47 -08:00
Arnold Schwaighofer
d5b3bfbd59 ArraySemantics: Add an api to replace a call to _getElement with a value
Also remove dependent calls to hoistableNativeTypeCheck() and checkSubscript()
calls. To find the guarding checkSubscript() call we introduce a return value to
checkSubscript that is used by the _getElement() call so that we can just follow
the use-def chain to find the dependence.
2015-12-08 07:34:25 -08:00
Arnold Schwaighofer
4b22a31154 ArraySemantics: Remove getArrayPropertyIsNative - we are only using
hoistableIsNativeTypeChecked these days.
2015-12-08 07:34:25 -08:00
Kanstantsin Linou
c9024ccc2c Fix typo in Arrays.swift.gyb
<code>accross</code> -> <code>across</code>
2015-12-08 17:39:28 +03:00
Mark Lacey
1905cdc9cb Merge pull request #347 from punchharpit/master
fix typo : avalance => avalanche
2015-12-08 05:35:08 -08:00
Mark Lacey
a7189700e6 Merge pull request #341 from RajkumarPunchh/rk-TypeFix-Formula
Fixed Typo. “forumula” to “formula”.
2015-12-08 05:29:38 -08:00
arpit
291d991969 fix typo : avalance => avalanche 2015-12-08 18:59:31 +05:30
Mark Lacey
41ce8fbb33 Merge pull request #344 from monicasoni/ms-fixTypo
Fix typo contigous => contiguous
2015-12-08 05:23:31 -08:00
Mark Lacey
fee396767f Merge pull request #342 from gauravds/gds-FixTypoChar
fix typo arthmetic => arithmetic
2015-12-08 05:22:03 -08:00
Monica Soni
9d98066d7d Fix typo contigous => contiguous 2015-12-08 18:03:00 +05:30
GauravDS
ff15547551 fix typo arthmetic => arithmetic 2015-12-08 17:13:33 +05:30
rajkumarpunchh
7a7efeb3cd Fixed Typo. “forumula” to “formula”. 2015-12-08 17:05:10 +05:30
GauravDS
8ac4d21fb0 Fix typo characterstics => characteristics 2015-12-08 15:09:50 +05:30
Dmitri Gribenko
31598d41bf Rename GeneratorType to IteratorProtocol 2015-12-07 17:08:32 -08:00
Dmitri Gribenko
3505975a75 Make EnumerateGenerator and EnumerateSequence initializers internal 2015-12-07 16:56:31 -08:00
Dmitri Gribenko
866ce291c3 Fix coding style 2015-12-07 16:56:18 -08:00
Dmitri Gribenko
f230ebeda9 Change EnumerateGenerator.Element's label from 'index' to 'offset' 2015-12-07 16:54:38 -08:00
Maxim Moiseev
7372e9e045 COpaquePointer => OpaquePointer 2015-12-07 16:52:45 -08:00
Max Moiseev
d0e1cb3a0e Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-07 16:43:20 -08:00
Nick van der Ploeg
42b4b02df3 Fixed typos in comments throughout the project. 2015-12-07 12:15:52 -06:00
Florian Reinhart
2134e55c25 Fix typo in comment 2015-12-07 14:24:11 +01:00
Radek Pietruszewski
d029f7e5ae Fix typo in UnavailableStringAPIs.swift.gyb 2015-12-06 11:28:35 +01:00
Dmitri Gribenko
8bba74eaee Merge pull request #241 from codestergit/master
[stdlib] Used map and guard for nil handling
2015-12-05 23:48:59 -08:00
Dmitri Gribenko
403b46ccea stdlib: simplify code 2015-12-05 23:29:31 -08:00
Dmitri Gribenko
4b8fff424b Merge pull request #270 from hamin/cleaning-up-cstyle-loops
A small step towards removing C-style loops
2015-12-05 22:47:26 -08:00
Haris Amin
0d001480a9 A small step towards removing C-style loops 2015-12-06 01:07:24 -05:00
codestergit
6e85e69283 [stdlib] Using map and guard let for nil handling 2015-12-06 04:01:33 +05:30