Commit Graph

75 Commits

Author SHA1 Message Date
Ben Cohen
4381735269 Switch Zip2Sequence.init to be internal (#20148) 2018-10-30 18:08:06 -07:00
Slava Pestov
7401aa607f IRGen: Fix runtime crash with default implementation of protocol requirement with a generic class
If the 'self' type is abstract, we still have to consider it as
a source of type metadata, because it might be a class-bound
generic parameter and the class might have generic parameters.

Fixes <rdar://problem/36093833>.
2017-12-21 17:28:52 -08:00
Slava Pestov
09b59c5336 DI: More tests 2017-10-20 16:10:32 -07:00
Slava Pestov
0c16aedb60 DI: All protocol extension initializers should be delegating
Previously protocol extension initializers which called 'self.init' were
considered 'delegating', and ones that assign to 'self' were considered
'root'.

Both have the same SIL lowering so the distinction is not useful, and
removing it simplifies some code.
2017-10-13 23:51:14 -07:00
Slava Pestov
5afaadfbc8 Sema: Requirement environments for protocol extension members in class conformances have an abstract 'Self'
Consider the following code:

protocol P {
  func foo<A>(_: A)
}

extension P {
  func foo<A>(_: A) {}
}

class C<T> : P {}

Before, the witness thunk for [C : P].foo() had the generic signature
<T, A>, and the witness P.foo() was called with a substitution
Self := C<T>.

This is incorrect because the caller might be using a subclass of C
as the 'Self' type, but this was being erased.

Now, the witness thunk for [C : P].foo() has the generic signature
<X : C<T>, T, A>, and the witness P.foo() is called with the
substitution Self := X.

Fixes <rdar://problem/33690383>, <https://bugs.swift.org/browse/SR-617>.
2017-10-09 19:53:50 -07:00
Jordan Rose
192b523a8e Revert "Fix issue with 'Self' metadata when class conforms to protocol with default implementations" (#12344)
It broke the 32-bit iOS simulator, and possibly the 64-bit simulator as well. Reverts 5618553.
2017-10-09 10:02:48 -07:00
Slava Pestov
b145d40329 Sema: Requirement environments for protocol extension members in class conformances have an abstract 'Self'
Consider the following code:

protocol P {
  func foo<A>(_: A)
}

extension P {
  func foo<A>(_: A) {}
}

class C<T> : P {}

Before, the witness thunk for [C : P].foo() had the generic signature
<T, A>, and the witness P.foo() was called with a substitution
Self := C<T>.

This is incorrect because the caller might be using a subclass of C
as the 'Self' type, but this was being erased.

Now, the witness thunk for [C : P].foo() has the generic signature
<X : C<T>, T, A>, and the witness P.foo() is called with the
substitution Self := X.

Fixes <rdar://problem/33690383>, <https://bugs.swift.org/browse/SR-617>.
2017-10-08 23:01:18 -07:00
Max Moiseev
b9fb3badc8 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-03-22 12:30:24 -07:00
Brian King
29c1fc472b Generate an error message on protocol extensions with the final attribute. 2017-03-09 14:18:39 -05:00
Max Moiseev
3522f3c47c Fixing tests with artihmetic operators back on concrete types 2017-01-23 14:56:29 -08:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Michael Ilseman
f48471ebd4 [noescape by default] purge tests of needless @noescape 2016-08-04 16:14:27 -07:00
Robert Widmann
4f465224ea Polish off uses of dynamicType in tests 2016-07-29 16:59:14 -07:00
Nate Cook
29bbff221b [stdlib] Update partition tests with feedback 2016-07-21 10:18:20 -05:00
Nate Cook
1d037800b9 [stdlib] Update tests for new partition APIs
Special thanks to @aschwaighofer for help with these tests and fix-its!
2016-07-21 10:18:20 -05:00
John McCall
82d849edd7 Remove the portions of these tests that were relying on old stdlib APIs.
Judging from history, the original tests appear to just be attempts to
flesh out test coverage rather than specific regression tests, and the
features in question are well-covered by other tests.
2016-05-10 14:17:35 -07:00
Dmitri Gribenko
2a07df42b8 XFAIL compiler tests that depend on stdlib implementation details
<rdar://problem/25666028> swift-3-indexing-model: Generics/associated_self_constraints.swift
<rdar://problem/25665969> swift-3-indexing-model: Interpreter/protocol_extensions.swift fails
<rdar://problem/25890224> swift-3-indexing-model: TEST 'Swift :: NameBinding/reference-dependencies.swift' FAILED
2016-04-25 11:44:34 -07:00
Dmitri Gribenko
2b35fea059 Merge remote-tracking branch 'origin/master' into swift-3-indexing-model 2016-04-16 00:30:12 -07:00
Chris Lattner
8746676616 Move @noescape and @autoclosure to their new places in various tests, NFC. 2016-04-15 16:05:35 -07:00
Dmitri Gribenko
10697f939f Merge commit '510f29abf77e202780c11d5f6c7449313c819030' into swift-3-indexing-model 2016-04-14 13:45:27 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Dave Abrahams
b4907cc81f [stdlib] indexing model: Undo test changes
Leave the test in (basically) its original state so my attempts to fix
it don't confuse Doug.
2016-03-18 15:20:01 -07:00
Dave Abrahams
2bb35646d7 [stdlib] indexing model: Fix tests for traversal
Traversal is now represented in the Collection hierarchy and the Index
hierarchy is gone.
2016-03-18 15:14:01 -07:00
Dave Abrahams
f493b54e44 [stdlib] indexing model: Interval/Range merge
This is step 1; we still need to introduce ClosedRange.
2016-03-16 15:59:10 -07:00
Max Moiseev
e48f452a2e Merge remote-tracking branch 'origin/swift-3-api-guidelines' into swift-3-api-guidelines 2016-02-29 12:15:33 -08:00
Max Moiseev
a49dab6bf8 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-29 12:08:52 -08:00
Daniel Duan
2bc78b8c09 [stdlib] update for 'inout' adjustment (SE-0031) 2016-02-26 12:02:29 -08:00
Jordan Rose
b319e3da32 stdlib: Adjust to insert(contentsOf:at:) and append(contentsOf:)
instead of insertContents(of:at:) and appendContents(of:),
originally insertContentsOf(_:at:) and appendContentsOf(_:)
per internal discussion.
2016-02-25 12:50:39 -08:00
Dmitri Gribenko
f0633ce5a9 stdlib: Sequence.iterator() => .makeIterator() 2016-02-23 13:52:30 -08:00
Max Moiseev
4b9eab6288 appendContentsOf => appendContents(of:) 2016-02-22 18:02:04 -08:00
Dmitri Gribenko
06577273e9 var Sequence.enumerated => func 2015-12-18 16:22:24 -08:00
Dmitri Gribenko
5b728dc859 Remove Range<Index> argument from Collection.partition()
collection.partition(i..<j) => collection[i..<j].partition()
2015-12-18 16:20:01 -08:00
Maxim Moiseev
9e50505970 internal or public // @testable initializers 2015-12-17 17:02:49 -08:00
Max Moiseev
3fe0c60d7f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2015-12-17 11:00:02 -08:00
Daniel Duan
ebb0c3a204 replaced single-line ++/-- with +=/-= 2015-12-15 09:05:37 -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
Dmitri Gribenko
5a07f89297 Remove 'generator' from names of test functions and local variables 2015-12-09 17:15:11 -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
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
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 Hrybenko
ee20926b20 stdlib: rename join() to joinWithSeparator()
rdar://22022419, rdar://21474222

Swift SVN r31188
2015-08-12 21:16:38 +00:00
Dmitri Hrybenko
d6f04ade75 stdlib: convert join() into a protocol extension
Part of rdar://22022419

Swift SVN r31186
2015-08-12 21:16:25 +00:00
Joe Pamer
828eb68e72 Commit DaveA's API changes to 'print', along with the compiler changes necessary to support them.
There's still work left to do. In terms of next steps, there's still rdar://problem/22126141, which covers removing the 'workaround' overloads for print (that prevent bogus overload resolution failures), as well as providing a decent diagnostic when users invoke print with 'appendNewline'.

Swift SVN r30976
2015-08-04 01:57:11 +00:00
Dave Abrahams
1f3bf276db Warning suppression in tests
Swift SVN r30751
2015-07-29 02:04:12 +00:00
Joe Groff
db0fea590e stdlib: Use unqualified names in 'print'.
Leave the qualification off of enum cases and type names when 'print'-ing them, but keep them on 'debugPrint'. (At least, at the outermost level; since ad-hoc printing of structs and tuples uses debugPrint, we'll still get qualification at depth, which kind of sucks but needs more invasive state management in print to make possible.) Implements rdar://problem/21788604.

Swift SVN r30166
2015-07-13 21:42:11 +00:00