Commit Graph

4650 Commits

Author SHA1 Message Date
Dmitri Gribenko
e5dba78263 Improve comments in String.swift 2015-12-09 17:18:46 -08:00
Dmitri Gribenko
9ca2775aa1 String.appendContentsOf() => .append()
We don't want to imply that String argument is a collection of anything.
2015-12-09 17:18:33 -08:00
Dmitri Gribenko
581fb3a100 Remove PermutationGenerator 2015-12-09 17:18:18 -08:00
Dmitri Gribenko
b7f3d54f4d removeAll(keepCapacity:) => removeAll(keepingCapacity:) 2015-12-09 17:18:08 -08:00
Dmitri Gribenko
f846ef6fd1 RangeReplaceableCollection.removeRange() => .removeSubrange() 2015-12-09 17:17:51 -08:00
Dmitri Gribenko
727f011314 RangeReplaceableCollection.insert(_:atIndex:) => .insert(_:at:) 2015-12-09 17:17:41 -08:00
Dmitri Gribenko
9a9ff305f1 RangeReplaceableCollection.replaceRange() => .replaceSubrange() 2015-12-09 17:17:34 -08:00
Dmitri Gribenko
ab0a2a6044 Rename 'subrange' to 'bounds' in non-API arguments 2015-12-09 17:17:20 -08:00
Maxim Moiseev
3910a00a35 AnyCollectionType => AnyCollectionProtocol 2015-12-09 17:17:07 -08:00
Maxim Moiseev
844b81c46b SequenceType => Sequence 2015-12-09 17:16:56 -08:00
Maxim Moiseev
c678a839dc IndexType => Index 2015-12-09 17:16:42 -08:00
Maxim Moiseev
6f4335ddc6 _ReverseCollectionType => _ReverseCollection 2015-12-09 17:16:31 -08:00
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
9ead96d232 renaming test files (less Type) 2015-12-09 17:15:41 -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
Andrew Trick
a98de1ba1c Add an Optional metadata kind for runtime casts.
Reuses the enum metadata layout and builder because most of the logic is
also required for Optional (generic arg and payload). We may want to
optimize this at some point (Optional doesn't have a Parent), but I
don't see much opportunity.

Note that with this approach there will be no change in metadata layout.
Changing the kind still breaks the ABI of course.

Also leaves the MirrorData summary string as "(Enum Value)". We should
consider changing it.
2015-12-09 15:01:33 -08:00
Manolo van Ee
3d919796ea Glibc module: detect location of glibc header files
In the Glibc module map all sys/... header files had the following paths:
/usr/include/x86_64-linux-gnu/sys/..., but some distros install them in
/usr/include/sys/...
2015-12-09 11:44:27 +01:00
Nadav Rotem
2b791e6336 Merge pull request #370 from pramodsharma403/ps-typo
Typo Fixed : implemention -> implementation
2015-12-08 21:41:24 -08:00
Nadav Rotem
3f46ee3683 Merge pull request #358 from chriseidhof/simplify-filter
Simplify filter implementation
2015-12-08 21:40:54 -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
John McCall
bdb4b896a2 Move ObjC-compatible unowned references to the new runtime
functions.

Take the code for the old, broken reference-counting
implementation and delete it with prejudice.
2015-12-08 16:20:32 -08: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