Commit Graph

5277 Commits

Author SHA1 Message Date
Karoy Lorentey
2b7ef24990 [stdlib] Dictionary.merge: Don’t leave storage in an inconsistent state when closure throws 2018-10-01 15:40:14 +01:00
Jordan Rose
d2fabf9242 [test] Test compiling the overlay swiftinterfaces to binary form (#19438) 2018-09-30 20:49:42 -07:00
Slava Pestov
2d4b25960d Sema: Type variables for opened generic parameters store the generic parameter type and not an archetype
There's no need to instantiate archetypes in the generic environment
of the declaration being opened.

A couple of diagnostics changed. They were already misleading, and the
new diagnostics, while different, are not any more misleading than
before.
2018-09-27 20:49:23 -07:00
Karoy Lorentey
65b4f12a5c Merge pull request #19591 from benrimmington/delete-chain-collision-randomized
[stdlib] Insert/remove same key in `SetTestSuite`
2018-09-28 02:20:35 +01:00
Karoy Lorentey
8c8f822b23 Merge pull request #19592 from lorentey/update-value-not-key2
[stdlib] Dictionary.updateValue(_:,forKey:): Don’t overwrite the existing key
2018-09-28 00:42:48 +01:00
Karoy Lorentey
7ff82b3ba9 [stdlib] Dictionary.updateValue(_:,forKey:): Don’t overwrite the existing key
Replacing the old key with the new is unnecessary and somewhat surprising. It is also harmful to some usecases.

rdar://problem/32144087

# Conflicts:
#	stdlib/public/core/NativeDictionary.swift
2018-09-27 21:20:54 +01:00
Ben Rimmington
897cce0eb6 [stdlib] Insert/remove same key in SetTestSuite 2018-09-27 13:47:52 +01:00
Mark Lacey
9cc817db1b Merge branch 'master' into fix-ordering 2018-09-26 17:43:35 -07:00
Mark Lacey
1d227731c1 [ConstraintSystem] Only use the new disjunction ordering under -swift-version 5.
This will minimize the chance of breaking code. Currently SwiftLint
has one "too complex" expression with this change. Further changes to
the solver may improve that situation, and potentially allow us to
move this out from -swift-version 5 if we're willing to take the risk
of breaking some code as a result.
2018-09-26 14:55:07 -07:00
Karoy Lorentey
b4e27b110a Revert "[stdlib] Dictionary.updateValue(_:,forKey:): Don’t overwrite the existing key" 2018-09-26 16:08:07 +01:00
Karoy Lorentey
1ab367b262 Merge pull request #19500 from lorentey/updateValue-but-not-the-key
[stdlib] Dictionary.updateValue(_:,forKey:): Don’t overwrite the existing key
2018-09-26 14:32:04 +01:00
Pavel Yaskevich
bd527c114e [CSBindings] Don't consider dependent member types even if they are wrapped in optionals
Because binding producer is going to attempt to unwrap optionals
and try the type, which would lead to infinite recursion because
dependent member types aren't bindable.

Resolves: rdar://problem/44770297
2018-09-25 20:59:58 -07:00
Karoy Lorentey
6cef0beff9 Merge pull request #19495 from lorentey/simplify-rawHashValue
[stdlib] Finalize one-shot hashing interface
2018-09-24 21:44:36 +01:00
Karoy Lorentey
a293ce15a6 [stdlib] Dictionary.updateValue(_:,forKey:): Don’t overwrite the existing key
Replacing the old key with the new is unnecessary and somewhat surprising. It is also harmful to some usecases.

rdar://problem/32144087
2018-09-24 15:44:43 +01:00
Mike Ash
1fb165a0ea Merge branch 'master' into rename-conflicting-classes-and-methods 2018-09-24 10:17:22 -04:00
Karoy Lorentey
b2ef455b3a [test] Update tests for _rawHashValue(seed:) changes 2018-09-24 13:31:19 +01:00
Karoy Lorentey
77dbc5b410 [test] Remove _Bitset tests 2018-09-22 02:04:11 +01:00
Karoy Lorentey
00bbf1bde3 [test] Fix flaky test 2018-09-22 02:04:10 +01:00
Karoy Lorentey
95d9fba1cc [test] Update tests for Set/Dictionary changes
Along with updating tests to adopt the new storage class names, the behavior of removeAll() has changed slightly.

If t stored an empty Set/Dictionary that was bridged from Objective-C, t.removeAlI() used to keep the original Objective-C storage intact. Now removeAll() replaces the old storage with the empty singleton, which makes a lot more sense to me.
2018-09-22 02:04:08 +01:00
Karoy Lorentey
19a6ca9ad2 [stdlib] Remove _UnsafeBitMap
Use _UnsafeBitset instead.
2018-09-22 02:04:05 +01:00
Karoy Lorentey
1848b37300 [stdlib] Add bitset constructs
Bitsets implement sorted sets over nonnegative integers up to a predetermined maximum value.

These are intended to replace _UnsafeBitMap. The latter will be removed once its usages are eliminated.

- _UnsafeBitset.Word is the underlying abstraction, implementing a bitset using a single UInt value.
- _UnsafeBitset is a view over a contiguous range of words.
- _Bitset is a COW value type implementing the same construct.
2018-09-22 02:04:04 +01:00
Mike Ash
49c3547449 Merge remote-tracking branch 'origin/master' into rename-conflicting-classes-and-methods 2018-09-21 15:52:38 -04:00
Jordan Rose
051e73883f [test] Separately validate the 'simd' overlay's swiftinterface (#19443)
It needs special options that aren't inferred yet, but with those it
passes, so let's test it.
2018-09-21 08:58:28 -07:00
Joe Groff
c87d2a8be2 Merge pull request #19340 from jckarter/generalize-tuple-extra-inhabitants
Generalize extra inhabitants of tuples.
2018-09-20 18:55:31 -07:00
Joe Groff
93d85997e8 Generalize extra inhabitants of tuples.
Like we did for structs, make it so that tuple types can also get extra inhabitants from whichever element with the most, not only the first. This lets us move all of the extra inhabitant handling functionality between structs and tuples in IRGen up to the common RecordTypeInfo CRTP base.
2018-09-20 15:39:44 -07:00
Mark Lacey
c6c66f6873 [ConstraintSystem] Change the order in which we visit disjunctions.
Attempt to visit disjunctions that are associated with applies where
we have at least some useful information about the types of all of the
arguments before visiting other disjunctions.

Two tests here got faster, and one slightly slower. One of the
faster tests is actually moving from test/ to the slow/ directory in
validation-test because despite going from 16s to less than 1s, it was
still borderline for what we consider the slow threshold, so I made
the test more complex. The one that got a little slower is
rdar22022980, which I also made more complex so that it is clearly
"slow" by the way we are testing it.

slower:
  rdar22022980.swift

faster:
  rdar33688063.swift
  expression_too_complex_4.swift
2018-09-20 13:15:59 -07:00
eeckstein
814e656cf9 Merge pull request #19388 from eeckstein/mangling-prefix
change mangling prefix from $S to $s
2018-09-20 09:16:30 -07:00
swift-ci
e5c9d6417e Merge pull request #19398 from DougGregor/resilient-table-init-empty-proto 2018-09-19 15:18:04 -07:00
Doug Gregor
3ed69d4ee7 [Runtime] Instantiate witness tables even with no resilient witnesses.
The witness table for an empty, resilient protocol might need to be
instantiated, if a newer version of the protocol contains defaulted
associated type requirements. In such cases, we would either fail to
instantiate or assert in the runtime. Replace the assertion with a
proper check (to require instantiation in such cases) and cope with
filling in defaults even when the provided generic witness table has
no resilient witnesses.
2018-09-19 14:00:28 -07:00
Erik Eckstein
39bb14b094 change mangling prefix from $S to $s
This is the final ABI mangling prefix

rdar://problem/38471478
2018-09-19 13:55:11 -07:00
Doug Gregor
32fd274f5e Merge pull request #19391 from DougGregor/assoc-conformance-default-witnesses
[ABI] Associated conformance defaults
2018-09-19 13:15:46 -07:00
Doug Gregor
fb62977c2b [IRGen] Emit default associated conformance witnesses.
For a resilient protocol that has defaulted associated types, emit
default associated conformance witnesses that compute associated
conformances based on that default witness.

This completes the implementation of resilience protocols that
add new, defaulted associated types, rdar://problem/44167982.
2018-09-19 10:56:20 -07:00
Joe Groff
fbd21e1bd4 Merge pull request #19296 from jckarter/opaque-existential-extra-inhabitants
Give opaque existential containers extra inhabitants.
2018-09-17 10:48:20 -07:00
Doug Gregor
ab61aaeed1 Resolve two crashers and fix a test issue on Linux. 2018-09-15 23:01:51 -07:00
Doug Gregor
2ef9363bd1 [ABI] Add default associated type witnesses to resilient protocols.
When an associated type witness has a default, record that as part of
the protocol and emit a default associated type metadata accessor into the
default witness table. This allows a defaulted associated type to be
added to a protocol resiliently.

This is another part of rdar://problem/44167982, but it’s still very
limiting because the new associated type cannot have any conformances.
2018-09-15 22:04:46 -07:00
Doug Gregor
350391db9d [ABI] Use associated type descriptors for generic parameter references.
Generic parameter references, which occur in generic requirement
metadata, were hardcoding associated type indices. Instead, use
relative references to associated type descriptors and perform the
index calculation at runtime.

Associated types can now be reordered resiliently (without relying on 
sorting), which is the first main step toward rdar://problem/44167982.
2018-09-14 20:59:03 -07:00
Slava Pestov
4ab28fb63c Add scale test for nested type extension binding
This performance problem was fixed a while ago by Doug's request
evaluator work.
2018-09-14 14:31:46 -07:00
Slava Pestov
8ddd2c02c4 Serialization: Serialize both the substituted and unsubstituted type for a NameAliasType 2018-09-14 14:31:46 -07:00
Joe Groff
b4abe8503a Give opaque existential containers extra inhabitants.
We can use the extra inhabitants of the type metadata field as extra inhabitants of the entire
existential container, allowing `Any?` and similar types to be the same size as non-optional
existentials.
2018-09-14 12:07:58 -07:00
Mike Ash
798edb9d0e [Runtime][Stdlib][Overlays] Rename various Objective-C classes and methods that would conflict when loading old Swift libraries into a process alongside ABI-stable libraries.
rdar://problem/35768222
2018-09-13 16:55:10 -04:00
Soroush Khanlou
5736cacc9a Add count(where:) and tests (#16099)
* add count(where:) and tests

* Revise count(where:) documentation

* Remove errant word in abstract

* add a benchmark for ranges and strings with help from @natecook1000

* update benchmark to use Array instead of Range
2018-09-13 12:37:06 -05:00
Xi Ge
c94bc1d7db Merge pull request #19260 from nkcsgexi/parse-other-type
Parser: allow on-demand member decl parsing for other nominal types.
2018-09-12 22:28:18 -07:00
Xi Ge
3f03202ba7 test: add a scale test for the number of IterableDeclContext getting parsed. 2018-09-12 14:20:56 -07:00
Ben Cohen
e338344bae Remove overloads that were needed pre-conditional conformance 2018-09-11 21:00:36 -07:00
swift-ci
864167f7a0 Merge pull request #19251 from natecook1000/nc-sort3-testfix 2018-09-11 10:05:07 -07:00
Nate Cook
42543e7bba Point the 'sort3/simple' test back at sort3 2018-09-11 11:31:53 -05:00
Maxim Moiseev
6fb3373322 [test] Sorting 2**21 arrays is probably not necessary
Addresses: <rdar://problem/44152615>
2018-09-10 15:40:31 -07:00
Slava Pestov
c4e04e74d8 Merge pull request #19177 from slavapestov/resilient-super-method-calls
Resilient super method calls
2018-09-10 07:43:50 -07:00
Doug Gregor
4e68ecf3c4 Merge pull request #19198 from DougGregor/assoc-type-inference-crash
[Associated type inference] Never infer a type involving archetypes and interface types
2018-09-08 14:33:54 -07:00
Slava Pestov
3808ae0d58 IRGen: Use method lookup function for resilient super method calls
Fixes <https://bugs.swift.org/browse/SR-3928>, <rdar://problem/31411193>.
2018-09-07 21:57:16 -07:00