Commit Graph

5674 Commits

Author SHA1 Message Date
Ross Bayer
d39dae54e4 [Build System: Python] Renamed the Python lint validation test and updated the contents to match the other tests. 2020-01-19 01:32:58 -08:00
Ross Bayer
83bfc69ea3 [Build System: update-checkout] Added a new run_test.py script to utils/update_checkout which is used to run the validation test. 2020-01-19 01:32:47 -08:00
Ross Bayer
de1759c84f [Build System: build-script] Added a new run_test.py script to utils/swift_build_support which is used to run the unit test suite. 2020-01-19 01:31:21 -08:00
Ross Bayer
7587c7c0ac [Build System: build-script] Re-structured the build_swift module tests to contain a build_swift directory.
Having the test directory match the module we are testing means we can have scripts in the top level of utils/build_swift which can also have tests. As part of this re-structure the test utilties have been simplified somewhat and all tests no longer use a custom TestCase, rather the standard one exposed by the unittest module.
2020-01-19 01:31:21 -08:00
swift-ci
740276362c Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-18 06:04:04 -08:00
eeckstein
3fd9098f67 Merge pull request #29274 from eeckstein/disable-slow-tests
tests: exclude some very long running tests from jobs with a non-optimized stdlib
2020-01-18 14:59:33 +01:00
Doug Gregor
86c13d3c74 Revert "Reimplement function builders as statement transformations." 2020-01-17 15:52:49 -08:00
swift-ci
3a0eb0760f Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-17 10:44:12 -08:00
Doug Gregor
09bfd9438f Merge pull request #29133 from DougGregor/generlize-function-builders
Reimplement function builders as statement transformations.
2020-01-17 10:39:46 -08:00
Erik Eckstein
79fb67f5df tests: exclude some very long running tests from jobs with a non-optimized stdlib
Those are tests which take > 1000s on some simulator configurations with a non-optimized stdlib.
We run those tests anyway with an optimized stdlib. So we don’t lose test coverage by disabling them for debug-stdlib.

This fixes some sporadic time outs on the CI jobs.
2020-01-17 16:51:02 +01:00
swift-ci
fd4e6e02f2 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-17 02:24:00 -08:00
Ross Bayer
31f063b8b8 [Build System: build-script] Remove the old arguments module hiding in swift_build_support in favor of the more featureful one living in build_swift. 2020-01-17 00:30:17 -08:00
Doug Gregor
a49f0091cb [Constraint application] Skip error expressions when applying builders.
If we encountered an error, just skip it; there's nothing more to do.
2020-01-16 13:19:21 -08:00
adrian-prantl
d52ec5d13f Merge pull request #29139 from adrian-prantl/55412775
Reflection: Implement a TypeRef -> Demangle tree adapter
2020-01-16 09:38:42 -08:00
Pavel Yaskevich
8269522f86 Merge pull request #28837 from xedin/rdar-56340587
[ConstraintSystem] Delay constraint generation for single-statement closure body
2020-01-16 00:29:11 -08:00
Adrian Prantl
ea2b5eced9 Reflection: Implement a TypeRef -> Demangle tree adapter.
To allow more pervasive use of TypeRefs in LLDB, we need a way to build mangled
names from TypeRef pointers to allow round-tripping between TypeRefs and AST
types. The goal is to experiment with making lldb::CompilerType backed by
TypeRefs instead of AST types.

<rdar://problem/55412775>
2020-01-14 17:50:01 -08:00
Rintaro Ishizaki
0aa3125b62 [Testing] Eliminate REQUIRES-ANY usage
REQUIRES-ANY is deprecated and being removed. Use boolean expressions.

rdar://problem/58549266
2020-01-14 10:21:49 -08:00
Pavel Yaskevich
30876a42de [TypeChecker] NFC: Mark test-case for rdar://problem/22022980 as "slow"
It used to be "fast" before because `selectDisjunction` used to pick
inner `==`s before outer one (which compares arrays) but now, since
constraint generation for the closure body is delayed, it looks
like the opposite is happening which makes this test-case go exponential.
2020-01-14 00:09:33 -08:00
Pavel Yaskevich
09e45823e2 [Diagnostics] NFC: Adjust test-cases improved by changes to closure expression handling 2020-01-14 00:09:33 -08:00
Pavel Yaskevich
3f1083e6c3 [TypeChecker] NFC: Mark perf test-case for rdar://problem/20959612 as "fast"
This test-case has been improved by changes in closure expression
handling in constraint system, because the bodies are going to be
opened in order, the nesting yields linear performance.
2020-01-14 00:09:33 -08:00
Rintaro Ishizaki
4ced714e25 [CodeCompletion] Allow type variable in MakeAbstractConformanceForGenericType
When typesSatisfyConstraint() is called with 'openArchetypes=true',
archetypes are substituted with type variables. If they have
conformances, they used to hit assertion in
'MakeAbstractConformanceForGenericType::operator()'.

Adjust the assetion to accept 'TypeVariableType'.

rdar://problem/56834798
2020-01-09 23:18:27 -08:00
Luciano Almeida
27b01e3eb0 [test] Adding validation test for generic function match 2020-01-09 14:10:37 -03:00
Joe Groff
509735ea66 IRGen: Work around RemoteMirror bug generating reflection info for empty builtin types.
The RemoteMirror library in shipping versions of macOS/iOS/tvOS/watchOS crashes if the compiler
emits a BuiltinTypeDescriptor with size zero. Although this is fixed in top-of-tree RemoteMirror,
we want binaries built with the new compiler to still be inspectable when run on older OSes.
Generate the metadata as an empty struct with no fields when deploying back to these older
platforms, which should be functionally equivalent for most purposes.
Fixes rdar://problem/57924984.
2020-01-06 19:32:43 -08:00
Karoy Lorentey
b7e08accb1 [stdlib] Slice: customize withContiguous[Mutable]StorageIfAvailable (#28883)
* [stdlib] Slice: customize withContiguous[Mutable]StorageIfAvailable

We can easily make an UnsafeBufferPointer that slices another UnsafeBufferPointer, so let’s allow Slice to vend a slice of the base collection’s contiguous storage, if it provides access to one.

We need to do some index distance calculations to implement this, but those will be constant-time in the usual case where the base collection is a RAC.

https://bugs.swift.org/browse/SR-11957
rdar://58090587

* [test] UnsafeBufferPointer: fix some warnings

* [stdlib] Slice: don’t calculate index distances unless the base provides contiguous mutable storage
2020-01-06 12:32:30 -05:00
Rintaro Ishizaki
091c36bc82 [CodeCompletion] Evaluate 'PatternBindingEntry' before checking the init
If a completion happens in an 'PatternBindingInitializer' context for
'TypedPattern' without any 'VarDecl', e.g.:

    let _: Int = <COMPLETION>

it crashes because 'typeCheckPatternBinding()' requires that the
'TypedPattern' has the type.

rdar://problem/52105899
2019-12-25 16:30:52 -08:00
Pavel Yaskevich
b03b356bfa Merge pull request #28880 from xedin/port-multi-stmt-closure-diags
[Diagnostics] Diagnose inability to infer (complex) closure return type
2019-12-19 14:17:34 -08:00
Mike Ash
8e7c6a5c14 [Test] Disable reflect_Enum_(254|Two)CaseNoPayloads.swift when testing the OS stdlib.
rdar://problem/58087442
2019-12-19 15:41:29 -05:00
Pavel Yaskevich
8bcc192591 [Diagnostics] Diagnose inability to infer (complex) closure return type 2019-12-19 12:16:30 -08:00
David Ungar
69d1060df1 Merge pull request #28867 from davidungar/enable-disable-off-by-default
[Driver, Incremental] Add enable- and disable- only-one-dependency-file flags off-by-default
2019-12-19 00:52:33 -08:00
David Ungar
0291b36739 off-by-default & fix tests 2019-12-18 22:35:26 -08:00
David Ungar
2a79331ac3 add -enable/disable-only-one-dependency-file flag, on by default 2019-12-18 16:07:51 -08:00
tbkka
2b5ada11cb Correctly calculate extra inhabitants for no-payload enums (#28830)
In particular, this fixes the size calculation for nested enums,
specifically enums within Optionals.  Without this, the
reflection library computes `v` below as requiring two bytes
instead of one.

```
enum E {
case a
case b
}

let v = Optional<E>
```

This also adds a number of test cases for enums alone and
wrapped in optionals, including:
* Zero-case enums are allocated zero size and have zero extra inhabitants
* Zero-case enums in optionals also get zero size
* One-case no-payload enums are allocated zero size and have zero extra inhabitants
* One-case no-payload enums in optionals get one byte allocated and have zero extra inhabitants
* 254-case enums have only two extra inhabitants, so putting them in thrice-nested optionals requires an extra byte
* Various cases where each nested optional gets an extra byte

Resolves rdar://31154770
2019-12-17 14:52:35 -08:00
Suyash Srijan
f8dace593c [Typechecker] Fix a crash related to use of invalid @autoclosure parameter 2019-12-17 03:24:09 +00:00
Saleem Abdulrasool
3cefb7b3f7 validation-test: mark test as XFAIL
TBD generation is not constrained to Darwin and it trips on the linker
synthetic `__ImageBase`.  XFAIL this until the TBD generation is either
constrained or is taught to ignore the synthetic.  This should
temporarily allow us to enable validation tests on Windows.
2019-12-14 22:15:01 -08:00
Pavel Yaskevich
fa77285c62 Revert "[TypeChecker] NFC: Disable SwiftUI test-case due to possible infinite…" 2019-12-09 12:12:51 -08:00
Pavel Yaskevich
e0aa646310 [TypeChecker] NFC: Disable SwiftUI test-case due to possible infinite loop
Resolves: rdar://problem/57756956
2019-12-09 10:58:05 -08:00
Pavel Yaskevich
cafa338ae3 Merge pull request #28594 from xedin/rdar-50420029
[ConstraintSystem] Guard against infinite recursion in key path dynam…
2019-12-05 14:34:10 -08:00
Doug Gregor
f19ca59317 Merge pull request #28449 from DougGregor/sr11599-testcase
[Test] Add already-fixed test from SR-11599 / rdar://problem/56190608
2019-12-05 13:39:10 -08:00
Pavel Yaskevich
1d393ebdd4 [ConstraintSystem] Guard against infinite recursion in key path dynamic member lookup
It's possible to construct subscript member responsible for key path
dynamic member lookup in a way which is going to be self-recursive
and an attempt to lookup any non-existent member is going to trigger
infine recursion.

Let's guard against that by making sure that the base type of the
member lookup is different from root type of the key path.

Resolves: rdar://problem/50420029
Resolves: rdar://problem/57410798
2019-12-05 12:42:17 -08:00
Slava Pestov
8b112232f1 Add regression test for https://bugs.swift.org/browse/SR-4571 2019-12-05 08:45:55 -05:00
Slava Pestov
39f392c39d Add regression test for https://bugs.swift.org/browse/SR-4211 2019-12-05 08:45:55 -05:00
Pavel Yaskevich
94b4052321 [CSDiag] NFC: Remove all of the obsolete diagnoseGeneral*Failures logic 2019-12-03 12:07:16 -08:00
Pavel Yaskevich
34f5b52db1 [Diagnostics] Diagnose ambiguities related to contextual type mismatch
If none of the candidates produce expected contextual type, record
all of the posibilities to produce a note per and diagnose this as
contextual type mismatch instead of a reference ambiguity.
2019-12-03 12:07:15 -08:00
swift-ci
31370df8f8 Merge pull request #28364 from apple/all-your-nsbase 2019-12-03 10:20:01 -08:00
swift-ci
19395d6a4d Merge pull request #28446 from DougGregor/rdar57040259 2019-12-02 18:33:39 -08:00
Hamish Knight
19e199e567 Use DefaultArgumentExpr for caller-side defaults (#28279)
Use DefaultArgumentExpr for caller-side defaults
2019-12-02 13:57:17 -08:00
Doug Gregor
929edd3cb3 [Test] Add already-fixed test from SR-11599 / rdar://problem/56190608 2019-11-22 16:14:04 -08:00
Doug Gregor
c4ed40dc15 [Type checker] Fix crash with invalid overriding property.
When an overriding property containing willSet or didSet is not within
a type, the type checker could crash due to a missing "self"
declaration. Check this condition. Fixes rdar://problem/57040259.
2019-11-22 15:38:05 -08:00
David Ungar
62ae2bfd2f Merge pull request #28164 from davidungar/WIP-custom-diff
[Incremental compilation] Source-range-based dependencies
2019-11-21 23:47:52 -08:00
Pavel Yaskevich
f7ee402d2f Merge pull request #28400 from xedin/rdar-57201781
[ConstraintSystem] Introduce notion of constraint system phase
2019-11-21 13:17:34 -08:00