Commit Graph

4289 Commits

Author SHA1 Message Date
Max Moiseev
f5e93f63e9 [tests] Add conformance tests for FlattenSequence/FlattenCollection 2017-12-19 14:58:25 -08:00
Doug Gregor
4a7386e0bb Merge pull request #13520 from DougGregor/conformance-checking-unsatisfied-reqs
[Conformance checking] Don't suppress substitution failures during checking
2017-12-18 21:52:57 -08:00
Doug Gregor
d9095b1079 [Conformance checking] Don't suppress substitution failures during checking.
When checking whether a particular protocol conformance satisfies all of
the protocol's requirements, we were suppressing substitution failures.
In some cases, this would mean that we marked a conformance "invalid"
without ever emitting a diagnostic, which would lead to downstream crashes.

Instead, treat substitution failures somewhat more lazily. If we encounter
one while performing the checking, put the conformance into a "delayed" list
rather than failing immediately. Teach the top-level type checking
loop to re-check these conformances, emitting a diagnostic if they
fail the second time around.

Fixes rdar://problem/35082483 and likely other issues that slipped
through the type checker or blew up in unpredictable ways.
2017-12-18 16:43:59 -08:00
Doug Gregor
607a0ddffb [Conformance checking] Record type witnesses for overridden associated types.
When we determine a type witness for an associated type, record that
same type witness for all of the associated types it overrides.
2017-12-18 16:43:55 -08:00
Doug Gregor
40207e8c60 Add test case for rdar://problem/26140749, a fixed crasher 2017-12-18 16:43:46 -08:00
Ben Cohen
9361a6b66f [stdlib] Nest Iterator and Index types for various stdlib types (#13489)
* Nest various top-level Iterator and Index types, and flatten extensions.

* Fix tests from nesting iterator

* Nest Unsafe*BufferPointer.Iterator, extensionify UnsafeBufferPointer

* Degyb LazyCollection

* Nest Flatten iterator and index
2017-12-18 15:27:35 -08:00
Max Moiseev
c27b366f46 [stdlib] Utilize conditional conformances for FlattenCollection (#13476)
* [stdlib] Utilize conditional conformances for FlattenCollection

* Fix indentation [NFC]
2017-12-16 10:57:02 -08:00
Rintaro Ishizaki
24c7ea15e7 [Parse] Disable token receiver while parsing types in editor placeholder
Otherwise, for `<#T##Type#>`, `TokReceiver` records
 `{'<#T##Type#>', 'Type'}`.
2017-12-16 10:48:12 +09:00
swift-ci
4e3125f4cb Merge pull request #13448 from DougGregor/protocol-typealias-declared-interface-type 2017-12-14 17:40:49 -08:00
Doug Gregor
949cd57996 This test case is crashing again. Acknowledge the regression. 2017-12-14 16:39:50 -08:00
Joe Shajrawi
1bb1b5de68 Add CHECK lines to 0134-rdar35947198 validation-test 2017-12-14 13:33:25 -08:00
Joe Shajrawi
65be47ef71 Merge pull request #13423 from shajrawi/verify_fix
hasValidLinkageForFragileRef: Add a test that checks if the containing module is serialized
2017-12-14 12:10:21 -08:00
Joe Shajrawi
027057f5d6 hasValidLinkageForFragileRef: Add a test that checks if the containing module is serialized
Commit 53754a7a69 added a module pass that serializes the entire module.
Part of that pass is a method called removeSerializedFlagFromAllFunctions that removes the serialized flag from all functions within the module, which allows for more optimizations and for a better dead function elimination.
The problem is that this might break the Devirtualizer: If we run Devirtualization after “SerializeSILPass”, and we do LinkAll after Devirtualizing a function, SIL Verifier will fail: a public_external [serialized] function might be calling a [serialized] function for which we removed the [serialized] flag and added said flag to the module itself.
The verifier thinks that a function_ref inside fragile function is referencing private or hidden symbol.
2017-12-13 19:08:13 -08:00
Jordan Rose
9a9ea6915f [PrintAsObjC] Downgrade +new unavailability to deprecation in Swift 4
The general policy has been that even if something crashes at run
time, we don't make it a hard error in Swift 4 mode (or Swift 3 mode!)
if it wasn't a hard error in Swift 4.0 (3.0). In this case, we thought
we could get away with it, and then it turns out it actually caused
some problems. (And as 2bc010681 shows, we can still make mistakes.)

This change isn't perfect because the diagnostic appears in /clients/
rather than in the module that's being compiled as Swift 4 (instead of
Swift 5). But it still means that someone who hasn't changed
/anything/ from a valid Swift 4.0 project will be able to compile
without any changes, even if they were relying on being able to call
+new when -init was unavailable for some reason.

More rdar://problem/35942058
2017-12-13 17:59:55 -08:00
Jordan Rose
7493eccaa9 [PrintAsObjC] Include a message when making +new unavailable
Another follow-up to 49c65facc9. We've seen a few people run into
this and not know what changed.

rdar://problem/35942058
2017-12-13 17:59:55 -08:00
Max Moiseev
1c75bd2433 Conditional conformances for LazyCollection
(cherry picked from commit 6e7b36a66c)
2017-12-11 10:46:40 -08:00
Max Moiseev
9e73d092ea Fix tests
(cherry picked from commit a1b1778c53)
2017-12-11 10:46:35 -08:00
Max Moiseev
1f78f3927b [stdlib] Conditional conformances for LazyMapCollection
(cherry picked from commit b927254564)
2017-12-11 10:46:30 -08:00
Max Moiseev
ea02806f28 [stdlib] Conditional conformances for LazyFilterCollection
(cherry picked from commit 833721a172)
2017-12-11 10:46:25 -08:00
swift-ci
9d0464c95c Merge pull request #13356 from atrick/cpf-bug 2017-12-10 16:40:28 -08:00
Andrew Trick
d2cc9d16e0 Un-XFAIL RangeReplaceable.swift.gyb test. 2017-12-10 14:58:50 -08:00
Graydon Hoare
62a6b74ad1 Revert "[stdlib] Conditional conformances for Lazy[Filter|Map]Collection" 2017-12-10 12:48:36 -08:00
Max Moiseev
6e7b36a66c Conditional conformances for LazyCollection 2017-12-08 12:53:24 -08:00
Max Moiseev
a1b1778c53 Fix tests 2017-12-08 12:53:24 -08:00
Max Moiseev
b927254564 [stdlib] Conditional conformances for LazyMapCollection 2017-12-08 12:52:12 -08:00
Max Moiseev
833721a172 [stdlib] Conditional conformances for LazyFilterCollection 2017-12-08 12:52:12 -08:00
Ben Cohen
4ddac3fbbd [stdlib] Eradicate IndexDistance associated type (#12641)
* Eradicate IndexDistance associated type, replacing with Int everywhere

* Consistently use Int for ExistentialCollection’s IndexDistance type.

* Fix test for IndexDistance removal

* Remove a handful of no-longer-needed explicit types

* Add compatibility shims for non-Int index distances

* Test compatibility shim

* Move IndexDistance typealias into the Collection protocol
2017-12-08 12:00:23 -08:00
swift-ci
2514f7061f Merge pull request #13330 from DougGregor/where-clause-ref-typealias-in-protocol 2017-12-07 15:38:53 -08:00
Jordan Rose
2bc0106810 [PrintAsObjC] Reintroduce +new when reintroducing -init. (#13320)
Follow-up to 49c65facc9 to account for subclasses. An unavailable
-init makes +new unavailable, but reintroducing it in a subclass
should reintroduce +new if the root class is NSObject (where +new is
implemented).

rdar://problem/35914080
2017-12-07 15:15:43 -08:00
Doug Gregor
25fc87ded0 Fix whitespace in a test 2017-12-06 16:35:59 -08:00
Doug Gregor
6eec137374 [Type checker] Don't check near-miss candidates of the wrong kind.
Fixes rdar://problem/35832679.
2017-12-06 14:01:47 -08:00
Ben Cohen
85d190cd7d [stdlib] Replace various uses of BlahSlice with Slice to reduce warnings (#13263)
* Kill the slice variants from the gybbed collection test types

* Handful more SDK instances

* Fix SequencesCollections.swift.gyb
2017-12-05 19:09:56 -08:00
Doug Gregor
e2f90cf781 Merge pull request #13250 from DougGregor/typealias-protocol-resolve-hack
[Type checker] Short-circuit uses of concrete typealiases in protocols.
2017-12-04 11:16:43 -08:00
Doug Gregor
04a9714d9b [Type checker] Short-circuit uses of concrete typealiases in protocols.
Hack to allow IndexDistance to become a deprecated typealias. The actual
fix here involves deeper surgery into the substitution machinery.
2017-12-04 10:05:48 -08:00
Arnold Schwaighofer
4739fab482 NSNumberBridging.swift stdlib tests also fail on armv7s
rdar://35814988
2017-12-04 08:06:26 -08:00
Karoy Lorentey
9fef06e59c Merge pull request #12752 from hamishknight/dictionary-subscript-addressor
[stdlib] Use addressor for Dictionary's subscript(_:default:)
2017-12-04 15:04:29 +01:00
Mark Lacey
66a11ce66b Revert "[ConstraintSystem] Use semantics providing exprs when dealing with favored types."
This reverts commit 2f80af15ec.

I expected this to have no effect, but it results in one of the
expression type checker tests taking longer, so that test was disabled.

This commit also re-enables the test since it now passes again.
2017-12-02 21:46:31 -08:00
Arnold Schwaighofer
2ca6e0372e InvalidStrideable.swift runs forever if compiled with Osize
rdar://35780657
2017-12-02 11:18:16 -08:00
Arnold Schwaighofer
2e99ddec69 Disable test that spuriously fails
SR-6520
2017-12-02 10:37:02 -08:00
Arnold Schwaighofer
8ebbf68e30 Disable test that breaks on armv7
rdar://35814988
2017-12-02 09:32:18 -08:00
Arnold Schwaighofer
d2842b17c0 Disable type_checker_perf fast test
Fails on bot.

SR-6518
2017-12-02 05:43:37 -08:00
Jordan Rose
ace0f56e9c Be way more conservative about marking dependencies as non-cascading (#13214)
Being part of the type of a private declaration isn't sufficient,
because that could be used for the inferred type of a non-private
variable/constant/property.

Also, introduce a new kind of dependency test that shows both that a
file A changes its interface based on a change in another file B, and
that the swiftdeps output for file A includes the dependency on file B
as cascading.

https://bugs.swift.org/browse/SR-6149
2017-12-01 18:35:18 -08:00
Greg Parker
da14cd79a6 [runtime] Clean up symbol exports in libc functions. (#13202) 2017-12-01 17:49:11 -08:00
Nate Cook
956e793ef0 Improve consistency in NSNumber bridging
This makes sure casts of NaN succeed, and init(exactly: NaN) fails.
2017-12-01 13:44:33 -06:00
Pavel Yaskevich
272fbb4609 [TypeChecker] NFC: Re-enable test-case for rdar://problem/18360240 in resilient builds
Resolves: rdar://problem/35779008
2017-11-30 17:48:47 -08:00
Mark Lacey
3cd9320e93 Merge pull request #13190 from rudkx/adjust-perf-tests
Increase the complexity of a couple type checker perf tests.
2017-11-30 17:17:02 -08:00
swift-ci
ceefc59a2d Merge pull request #13187 from xedin/rdar-35779008 2017-11-30 16:17:29 -08:00
Mark Lacey
c7e52922e4 Increase the complexity of a couple type checker perf tests.
Recent changes have made these tests borderline slow, which means they
no longer fail.

Let's make them really slow instead!

(...since they do not scale well, and we cut the actual testing time off at
1s in the solver, which means really slow isn't going to affect test
time much).
2017-11-30 16:00:32 -08:00
Pavel Yaskevich
164baacfa5 [TypeChecker] NFC: Increase polynomial threshold for rdar://18360240 test-case 2017-11-30 15:19:14 -08:00
Ben Cohen
dcab9493ae Removed some warnings (#12753) 2017-11-30 15:12:56 -08:00