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.
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.
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>
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.
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.
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
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.
* [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
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
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
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.
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
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.
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.