Commit Graph

5277 Commits

Author SHA1 Message Date
Doug Gregor
8a2ce9bdf7 [Associated type inference] Never infer a type involving archetypes and interface types.
Works around an oddity of the associated type inference when the
potential witness is generic and returns (e.g.) Self.

Associated type inference needs to move off of archetypes for the
implementation to become sane. For now, this eliminates a crash.

Fixes rdar://problem/43591024.
2018-09-07 14:20:41 -07:00
Jordan Rose
b7aacec9ce [test] Fix swift-reflection-test issues for all test run environments (#19171)
I stopped trying to guess and actually tested them all, including the
Apple-internal tool I keep breaking. As a bonus, the RUN lines in
validation-test/Reflection/ go back to being simple.

rdar://problem/44154961
2018-09-06 16:05:56 -07:00
Jordan Rose
7ec1db9aa3 Re-apply "[test] Yet more tweaks to remote-run" (#19150) 2018-09-05 19:24:51 -07:00
Graydon Hoare
19b946a003 <rdar://43955209> Attempt yet again to make overlong-argv test less flaky.
The last attempted fix relied on the assumption that lit was emulating shell
glob-expansion semantics, which it turns out it does not: lit looks at any 'cd'
command on a RUN line and then applies the specified directory as an absolute
prefix when resolving any subsequent non-absolute globs on the command line.
I.e. it will interpret the second line of:

   RUN: touch /tmp/foo{1,2,3}.swift
   RUN: cd /tmp && echo foo*.swift

as

   RUN: cd /tmp && echo /tmp/foo1.swift /tmp/foo2.swift /tmp/foo3.swift

whereas sh interprets it as (and I wrote the last attempt relying on):

   RUN: cd /tmp && echo foo1.swift foo2.swift foo3.swift

This new attempt therefore bypasses lit entirely and just delegates to sh.
While it might not be the most tasteful choice, it does what we want and in the
process lets us use loops to construct our testcase.
2018-09-05 14:55:24 -07:00
Jordan Rose
1377722f86 Revert "[test] Yet more tweaks to remote-run" 2018-09-05 10:29:01 -07:00
Jordan Rose
9ff695f81e Merge pull request #19130 from jrose-apple/run-remote-run
[test] Yet more tweaks to remote-run
2018-09-04 20:37:15 -07:00
Jordan Rose
c52809be0f [test] One last tweak to "%target-run-reflection-test"
Copy %target-swift-reflection-test into %t instead of using a hard
link. The problem with hard links is that they can be overwritten when
the test fails, which would then truncate the original executable to
an empty file!
2018-09-04 18:25:24 -07:00
Slava Pestov
b7449d5621 IRGen/Runtime: Method override descriptors 2018-09-04 14:46:34 -07:00
Kirill Chibisov
aa34eb24d1 [stdlib][fix] Fixed wrong sorting behavior (#19107)
* [stdlib] Fixed wrong sorting behavior

* [stdlib] Refactored siftDown.

* [stdlib][test] Added tests for heapSort.
2018-09-04 10:44:16 -07:00
Jordan Rose
e3f3e939cb [test] Fix target-based reflection tests for real (#19098)
- Hard-link %target-swift-reflection-test into %t/ for %target-run
  implementations that copy executables, like remote-run.
- Use DYLD_LIBRARY_PATH to undo that for %target-run implementations
  that run the executable in place (host and simulators)

rdar://problem/43809613
2018-09-04 08:45:25 -07:00
Pavel Yaskevich
a69c6e2964 [CSBindings] Don't record duplicate bindings for opened nominal types
Otherwise it would result in checking the same type multiple times
and results in worse pontential binding picks.
2018-08-30 18:15:55 -07:00
Pavel Yaskevich
f110942097 Merge pull request #19066 from xedin/try-typevar-bindings-cleanup
[CSBindings] Cleanup `tryTypeVariableBindings`
2018-08-30 16:12:51 -07:00
Jordan Rose
296afc7773 [test] Add a test for SR-8493, so we don't regress (#19068)
https://bugs.swift.org/browse/SR-8493
2018-08-30 11:13:01 -07:00
Pavel Yaskevich
2ae8e8d0cb [CSBindings] Cleanup tryTypeVariableBindings
* Move logic to ensure that r-value type var would get r-value type to `PotentialBindings`;
* Strip uncessary parens directly when creating `PotentialBinding`;
* Check if the binding is viable before inclusion in the set, instead of filtering it later;
* Assert that bindings don't have types with errors included in the set.
2018-08-30 00:08:26 -07:00
Slava Pestov
3a6bea9f0d Merge pull request #19060 from slavapestov/executable-test-missing
These tests require the ability to execute code
2018-08-29 17:15:27 -07:00
Slava Pestov
432644ad20 These tests require the ability to execute code 2018-08-29 14:47:50 -07:00
Doug Gregor
ecf752d54b Revert "Revert " [Foundation] Collapse (SignedInteger|UnsignedInteger) reqts into FixedWidthInteger"" 2018-08-29 13:18:44 -07:00
Jordan Rose
11bddb49a0 [test] Temporarily disable Reflection tests on non-macOS (#19031)
utils/remote-run will only run things in %t.
An Apple-internal tool doesn't follow symlinks.
Normal macOS and simulator runs find the support libraries relative to
the binary.

I'm not sure what to do yet, but for now let's unbreak the
Apple-internal bots I broke in 01a0de2.
2018-08-29 11:38:27 -07:00
Mike Ash
8a9065a369 Revert " [Foundation] Collapse (SignedInteger|UnsignedInteger) reqts into FixedWidthInteger" 2018-08-29 13:55:20 -04:00
Doug Gregor
4b625a3dda Merge pull request #19006 from DougGregor/error-bridging-integer-type
[Foundation] Collapse (SignedInteger|UnsignedInteger) reqts into FixedWidthInteger
2018-08-29 08:37:02 -07:00
Doug Gregor
9e2ebd01db Merge pull request #19021 from DougGregor/sr-8642
[Conformance lookup] Don’t form an inherited conformance to an error type.
2018-08-28 17:05:41 -07:00
Slava Pestov
865b613d5e Sema: Stop using FunctionType::getOld() in CSDiag
We were building the following constraint, where $member and
$input are type variables and 'result' is a concrete type:

- Conversion($member, $input -> result)

When $member was fixed to a function type of arbitrary
arity, this would simplify to a conversion between $member's
result type and 'result'.

Instead, express this using the newly-added FunctionResult
constraint:

- FunctionResult($member, $result)
- Conversion($result, result)

I wasn't expecting this to change diagnostics, but it looks
like it did; I'm not going to bother investigating why,
because Pavel is going to rewrite contextual diagnostics soon
anyway. All but one are clear improvements.

Fixes <rdar://41416346> and <rdar://41416647>, two cases where
diagnostics regressed from -swift-version 3 to -swift-version 4.
2018-08-28 14:38:00 -07:00
Ben Cohen
83823f5f7f [stdlib] Obsolete various compatibility shims in 5.0 (#19008)
* Obsolete ModifierSlice typealiases in 5.0

* Obsolete *Indexable in 5.0

* Obsolete IteratorOverOne/EmptyIterator in 5.0

* Obsolete lazy typealiases in 5.0

* Drop .characters from tests

* Obsolete old literal protocols in 5.0

* Obsolete Range conversion helpers in 5.0

* Obsolete IndexDistance helpers in 5.0

* Obsolete Unsafe compat helpers in 5.0

* Obsolete flatMap compatibility helper in 5.0

* Obsolete withMutableCharacters in 5.0

* Obsolete customPlaygroundQuickLook in 5.0

* Deprecate Zip2Sequence streams in 5.0

* Replace * with swift on lotsa stuff

* Back off obsoleting playground conformances for now
2018-08-28 13:20:25 -07:00
Doug Gregor
15a538ae1a [Reflection] Add a test for reflection on nested generic types. 2018-08-28 10:49:01 -07:00
Doug Gregor
a4d464fb94 [Conformance lookup] Don’t form an inherited conformance to an error type.
Fixes SR-8642, a crash-on-invalid.
2018-08-28 09:55:45 -07:00
Jordan Rose
01a0de27ec [test] Update for remote-run-ing tests on a different macOS (#18966)
Most of this is just "remember to specify the inputs and outputs on
the command line, so remote-run can see them". A bit is "prefix
environment variables with '%env-'". And the last few are "yeah,
this was never going to work in a remote environment".

In the few cases where I couldn't think of anything reasonable, I just
marked the test as "UNSUPPORTED: remote_run", a new "feature".
2018-08-27 14:50:40 -07:00
Ben Cohen
75018155ff Kill old set/dictionary-specific bridging entrypoints (#18930) 2018-08-25 07:27:26 -07:00
Ben Cohen
293da8fa3e [stdlib] YAIAPR (#18956)
* Scrap Comparable conformance for _SwiftNSOperatingSystemVersion

* Lazy performance needs specialization

* Uninline dump/stdout

* Bool consistency

* fixup CollectionOld

* Uninline printing functions
2018-08-24 14:00:19 -07:00
Slava Pestov
a86a71de1e Runtime/IRGen: Two-phase metadata initialization for non-resilient classes
Note that this patch also consolidates the recursive metadata tests
into one place while adding an execution test.
2018-08-20 16:23:07 -07:00
Joe Groff
8f88db3039 Merge pull request #18795 from jckarter/categorize-metadata-kinds
Redistribute metadata kind constants to delineate ABI vs private values.
2018-08-20 13:32:27 -07:00
Joe Groff
5461b1b079 Don't hardcode metadata kind constants in tests. 2018-08-20 10:49:40 -07:00
Rintaro Ishizaki
592b5de206 [CodeCompletion] Remove a wrong assert()
`CS.solve()` with `FreeTypeVariableBinding::Disallow` still may emit
unresolved type. e.g. `DeclRefExpr` to decl with unresolved type.

https://bugs.swift.org/browse/SR-8568
rdar://problem/43433253
2018-08-20 19:50:09 +09:00
Ben Cohen
bd310140f3 [stdlib] Modernize sort code (#18824)
* Replace bodies of Comparable versions with calls to sort(by:)

* Make _insertionSort a method

* Make _sort3 a method

* Make _partition a method

* Make _introSort a method

* Make _siftDown, _heapify, _heapsort methods

* Other minor cleanup
2018-08-19 11:36:10 -06:00
Greg Titus
32eacc5e80 Merge pull request #18608 from gregomni/rvalue-as-lvalue
[ConstraintSystem] New FailureDiagnostic for rvalues that should be lvalues
2018-08-18 11:43:23 -07:00
gregomni
aeb96274d2 Apply the solution to the CS before diagnosing solution fixes. 2018-08-18 08:38:16 -07:00
Rintaro Ishizaki
682fc12c39 [Parse] Don't use getAsNominalTypeOrNominalTypeExtensionContext in Parse
`getAsNominalTypeOrNominalTypeExtensionContext()` requires fully parsed
AST. Use `isTypeContext()` instead.

https://bugs.swift.org/browse/SR-8554
rdar://problem/43394866
2018-08-18 12:48:13 +09:00
Jordan Rose
1663ee7ffd [test] Move slow StringMemoryTest to validation-test (#18776)
This test takes over a minute to run, and all it's doing is testing
that repeated operations on a string don't leak.
2018-08-17 08:46:53 -07:00
Karoy Lorentey
9eb2743dd9 [stdlib] _UnsafeBitMap: make internal; force-inline members
A Dictionary.removeValue(forKey:) benchmark regressed 35% because recent changes in this PR caused an _UnsafeBitMap member to not be inlined in its implementation. (This was probably triggered by moving a method from Dictionary._Variant to _NativeDictionary.)
Add @inline(__always) to _UnsafeBitMap members.

While we’re at it, make _UnsafeBitMap @usableFromInline. It’s only public for testing purposes.
2018-08-16 20:05:32 +01:00
Karoy Lorentey
e2fb468b97 [stdlib] Set, Dictionary: Review native & cocoa representations
- Remove buffer suffix from type, property & variable names
  struct _NativeSetBuffer => _NativeSet
  struct _NativeDictionaryBuffer => _NativeDictionary
  struct _CocoaSetBuffer => _CocoaSet
  struct _CocoaDictionaryBuffer => _CocoaDictionary

- Remove internal typealiases related to these types
- Move nativeDelete, nativeMapValues from variant enum to corresponding struct
2018-08-16 20:05:32 +01:00
Ben Cohen
6f91a4e3dd [stdlib] Migrate remaining stdlib tests from Swift 3 (#18740)
* Migrate remaining stdlib tests from Swift 3

* Fix misprunt

* Remove seemingly pointless loops
2018-08-16 08:44:04 -06:00
Rintaro Ishizaki
5753e122cf Merge pull request #18721 from rintaro/ide-rdar41224316
[CodeCompletion] Remove unresolved type in prepareForRetypechecking()
2018-08-16 15:46:51 +09:00
Rintaro Ishizaki
c68157a27d [CodeCompletion] Remove unresolved type in prepareForRetypechecking()
Unresolved type attached to expressions may fail re-typechecking.
Also, disallow unresolved type in typeCheckCompletionSequence(). It doesn't
provide useful completions to developers.

rdar://problem/41224316
2018-08-15 20:39:12 +09:00
Doug Gregor
92d622ab41 [Type checker] Eliminate TypeResolverContext::GenericSignature.
The name-lookup behavior that avoids looking for members of a nominal type
or extension therefore when resolving the inheritance clause is now
handled by UnqualifiedLookup, so remove it from the type checker itself.

Fixes rdar://problem/39130543.
2018-08-14 23:17:57 -07:00
swift-ci
88582dbf63 Merge pull request #18607 from graydon/rdar-42816290-overlong-argv-make-room-for-driver-argv 2018-08-14 17:11:20 -07:00
Pavel Yaskevich
3ba8325c3f Merge pull request #18691 from xedin/fix-missing-conformance-diags-to-skip-all-operators
[Diagnostics] Don't try to diagnose missing conformance for any type …
2018-08-13 19:38:54 -07:00
Rintaro Ishizaki
67f691503d Merge pull request #18665 from rintaro/rdar42639255
[ConstraintSystem] Remove any semantic expression in SanitizeExpr
2018-08-14 11:00:01 +09:00
Pavel Yaskevich
3c7d7782db [Diagnostics] Don't try to diagnose missing conformance for any type of operator call
My original diagnostic changes included only `BinaryExpr` but there
are also postfix/prefix that I missed.
2018-08-13 18:06:49 -07:00
Rintaro Ishizaki
9f91899afd Merge pull request #18589 from rintaro/rdar43057057
[Parse] Set ErrorType to invalid ParamDecl
2018-08-14 07:58:12 +09:00
Arnold Schwaighofer
b9fe52ed13 Codesign validation-test/Sema/rdar32204609.swift 2018-08-13 08:32:58 -07:00
Rintaro Ishizaki
7532da4e37 [ConstraintSystem] Remove any semantic expression in SanitizeExpr
Existence of semantic expr (`getSemanticExpr()`) prevents ASTWalker
walking into the *original* sub expressions which may cause
re-typechecking failure. For example,
`ConstraintGenerator::visitArrayExpr()` assumes we already visited its
elements, but that's not the case if the semantic expr exists.

rdar://problem/42639255
2018-08-13 20:36:07 +09:00