Commit Graph

7754 Commits

Author SHA1 Message Date
Karoy Lorentey
8e4b53b5ad [stdlib][test] Add a bit more extensive tests for high-level set operations 2021-11-02 19:35:22 -07:00
Pavel Yaskevich
d72871c0e3 [Diagnostics] Coercion warning shouldn't assume that IUO is always optional
In situations like `_ = ... as! Bool!` the `to` type could either
be represented by an optional (default) or unwrapped. Coercion warnings
cannot assume that `to` (even though its IUO) is always represented
as an optional type.

Resolves: rdar://83072606
2021-11-02 13:42:11 -07:00
Karoy Lorentey
e2cfab4f28 [stdlib][test] Adopt availability macros in tests 2021-10-31 15:00:58 -07:00
Karoy Lorentey
8e154a415a Merge pull request #39962 from lorentey/concurrency-availability
[stdlib] Introduce availability macros
2021-10-31 14:23:57 -07:00
nate-chandler
22609acef5 Merge pull request #39957 from nate-chandler/rdar80704984_2
[SILGen] Handled foreign funcs with async, error, and more args.
2021-10-29 13:49:18 -07:00
Karoy Lorentey
47956908b7 [Concurrency] SwiftStdlib 5.5 ⟹ SwiftStdlib 5.1 (usages)
The concurrency runtime now deploys back to macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, which corresponds to the 5.1 release of the stdlib.

Adjust macro usages accordingly.
2021-10-28 14:36:36 -07:00
Nate Chandler
bc09cc9cf8 [SILGen] Handled foreign funcs with async, error, and more.
In 1ae317dd88, all the machinery was added
to enable calling ObjC functions that have both async and error
conventions.  The handling that was added for matching up arguments and
parameters, however, failed to handle functions that had both foreign
async and foreign error and other arguments.  Here, that handling is
fixed.

The fix is in four parts:
- Reverting to a single call to CallSite::emit to emit the formal
  params.  At this point, the foreign async and/or error params will be
  claimed as well.
- Separately counting the async and error parameters in
  ParamLowering::claimParams to ensure we get the right parameter
  slices.
- Letting ArgEmitter::maybeEmitForeignArgument look for an error
  parameter even if it already found an async parameter.
- Letting ArgEmitter::maybeEmitForeignArgument keep looking for foreign
  arguments after it finds one.

rdar://80704984
2021-10-28 13:42:08 -07:00
nate-chandler
1b3fa26a5c Merge pull request #39883 from nate-chandler/lexical_lifetimes/avoid-incorrect-elimination
[SILOptimizer] Keep lexical lifetime markers.
2021-10-28 10:54:59 -07:00
swift-ci
b2732e5755 Merge pull request #39881 from porglezomp-misc/upload-dylibs-concurrency-back-deploy 2021-10-24 13:37:21 -07:00
Cassie Jones
c59b238e0a [test] Enable some language features in validation-test
The logic in test/lit.site.cfg.in and validation-test/lit.site.cfg.in is
largely duplicated. This adds some of the missing features in order to
try to fix backdeployconcurrency testing. This should be more
fundamentally fixed to keep the different test configs in sync.
2021-10-24 14:03:00 -04:00
Cassie Jones
d1fe263e48 [test] Mark availability on failing validation-tests
The validation-test suite was incorrectly being run without the
concurrency feature enabled, so the tests were disabled. Now that
they're running, they need fixed availability annotations.
2021-10-24 14:03:00 -04:00
Nate Chandler
3bb1766a5f [SILOptimizer] Keep lexical lifetime markers.
Previously, TempRValueElimination would peephole simple alloc_stacks,
even when they were lexical; here, they are left for Mem2Reg to properly
handle.

Previously, SemanticARCOpts would eliminate lexical begin_borrows,
incorrectly allowing the lifetime of the value borrowed by them to be
observably shortened.  Here, those borrow scopes are not eliminated if
they are lexical.

Added an executable test that verifies that a local variable strongly
referencing a delegate object keeps that delegate alive through the call
to an object that weakly references the delegate and calls out to it.
2021-10-22 15:00:23 -07:00
Holly Borla
4fc5830d10 [Test] Complicate a "fast" type checker test to make it slow.
This test only happened to be under the constraint system thresholds,
but the performance was not fast. Add a few operands to the + chain,
and disable shrink to push the solver past the performance thresholds.
2021-10-21 15:43:30 -07:00
Saleem Abdulrasool
15a5d2c54b Revert "[android] Update to NDK 23" 2021-10-16 11:07:23 -07:00
swift-ci
46f3cc9dd8 Merge pull request #39045 from buttaface/android-ndk-23 2021-10-15 20:55:19 -07:00
Pavel Yaskevich
55a75ed89b [TypeChecker] NFC: Add a test-case for rdar://80630127 2021-10-14 13:07:12 -07:00
Kuba (Brecka) Mracek
c2c1bfb053 Add SWIFT_STDLIB_HAS_ENVIRON to remove usage of getenv/environ from stdlib (#39599) 2021-10-12 07:16:36 -07:00
Butta
7fa1b4b2ac [android] Update to NDK 23
The latest Long Term Support NDK finally removed binutils, including the bfd/gold
linkers and libgcc. This simplifies our Android support, including making lld the
default linker for Android. Disable three reflection tests that now fail, likely
related to issues with swift-reflection-dump and switching to lld.

Also, add the libatomic dependency for Android armv7, just as on linux.
2021-10-12 12:37:01 +05:30
Mishal Shah
c2fd49cebb Merge pull request #39473 from apple/rebranch
Update swift:main to support llvm-project:stable/20210726 changes (Rebranch merge)
2021-10-11 09:00:51 -07:00
Slava Pestov
8ab330a32d RequirementMachine: Add some testcases 2021-10-09 19:11:15 -04:00
swift-ci
3f8fea8508 Merge remote-tracking branch 'origin/main' into rebranch 2021-10-06 10:17:29 -07:00
Kuba (Brecka) Mracek
25e18e9a5c Enable LTO on the stdlib for the 'minimal' preset (#39292) 2021-10-05 07:38:01 -07:00
swift-ci
c51550f30e Merge remote-tracking branch 'origin/main' into rebranch 2021-09-30 15:11:41 -07:00
Evan Wilde
6956b7c5c9 Replace /usr/bin/python with /usr/env/python
/usr/bin/python doesn't exist on ubuntu 20.04 causing tests to fail.
I've updated the shebangs everywhere to use `/usr/bin/env python`
instead.
2021-09-28 10:05:05 -07:00
Doug Gregor
293e47a351 Handle missing Sendable conformances in SILFunctionType substitutions.
Fixes SR-15248 / rdar://83556240.
2021-09-27 13:35:46 -07:00
Konrad `ktoso` Malawski
e7342eb878 Merge pull request #39365 from kateinoigakukun/katei/fix-coop-executor-part-2
[Concurrency] repair cooperative executor and its tests
2021-09-27 09:47:09 +09:00
Alejandro Alonso
88bf2108a8 Mark CharacterPropertiesLong as long_test (#39437) 2021-09-24 03:08:40 -07:00
Slava Pestov
579e37d21f Merge pull request #39425 from slavapestov/disable-rqm-for-compiler-crasher
Disable requirement machine with compiler_crashers_2_fixed/0022-rdar21625478.swift for now
2021-09-23 21:16:28 -04:00
Slava Pestov
4c8e7429f3 Disable requirement machine with compiler_crashers_2_fixed/0022-rdar21625478.swift for now 2021-09-23 14:44:31 -04:00
Holly Borla
2032da0443 [Test] Add type checker performance tests using description(with:) and
count(where:).
2021-09-22 13:33:44 -07:00
Yuta Saito
722d790480 [test] mark multi-thread based tests as UNSUPPORTED in single-thread
Some of test cases assumes that the runtime is built for multi-threaded
platform.
2021-09-21 22:55:29 +00:00
Robert Widmann
6ffd6f5f8f [NFC] Strip Unnecessary %s's out of Tests
%target-typecheck-verify-swift already implies the current file being passed to the frontend - these just lead to duplicate input file errors.
2021-09-20 11:50:37 -07:00
Alejandro Alonso
12b9566f7b Add availability around new Unicode test (#39250) 2021-09-13 13:33:24 -07:00
Kuba (Brecka) Mracek
8b189d99e4 Turn off SWIFT_ENABLE_REFLECTION on the stdlib_minimal preset (#39030) 2021-09-12 18:54:53 -07:00
Slava Pestov
8b59660143 GSB: Don't infer requirements from type constructors in a protocol inheritance clause
This enabled a gross idiom that should not have been allowed in the first place:

    typealias G<T> = Any where T : P

    protocol P {}
    protocol Q : G<Self> {} // Q inherits from P now!

I'd like to ban this, assuming nothing is actually relying on this behavior.
2021-09-06 23:35:19 -04:00
Slava Pestov
4a019f0662 Sema: Improved recovery from circular generic signature construction
Returning a null GenericSignature is not the right way to break a cycle,
because then callers have to be careful to handle the case of a null
GenericSignature together with a non-null GenericParamList, for example
in applyGenericArguments().

An even worse problem can occur when a GenericSignatureRequest for a
nested generic declaration requests the signature of the parent context,
which hits a cycle. In this case, we would build a signature where
the first generic parameter did not have depth 0.

This makes the requirement machine upset, so this patch implements a new
strategy to break such cycles. Instead of returning a null
GenericSignature, we build a signature with the correct generic
parameters, but no requirements. The generic parameters can be computed
just by traversing GenericParamLists, which does not trigger more
GenericSignatureRequests, so this should be safe.
2021-09-04 00:13:03 -04:00
Pavel Yaskevich
35a0dab833 Merge pull request #39142 from xedin/fix-IUO-in-result-builders
[ConstraintSystem] Fix incorrect type-check of IUO pattern bindings
2021-09-02 17:33:54 -07:00
Michael Gottesman
7f273a1d48 Merge pull request #39129 from gottesmm/pr-ce6749f7a3c9f7189d38038a4f6210a168c2d0e0
[build-script] Add an option for cleaning the install destdir
2021-09-02 15:04:05 -07:00
Michael Gottesman
8794dd1003 [build-script] Add an option for cleaning the install destdir
Useful to make sure that one is not hitting weird behavior due to a stale just
built toolchain.
2021-09-02 12:25:40 -07:00
Pavel Yaskevich
20431b9dc6 [ConstraintSystem] Fix incorrect type-check of IUO pattern bindings
Patterns associated with `PatternBindingDecl`s have to be type-checked
in pattern binding context. Not doing so might result in spurious errors.
2021-09-02 10:17:09 -07:00
Holly Borla
d2bdbd6208 [ConstraintSystem] Fix a silly crash in repairFailures.
The code checked if the last element of locator path vector
is a certain kind of element without first ensuring that the
vector isn't empty.
2021-09-01 13:48:29 -07:00
Michael Gottesman
8109819e21 [build-script-impl] Do not actually try to extract symbols when we perform a dry-run.
Otherwise, we can't successfully dry-run a toolchain on darwin.

I added an option enable-extract-symbol-dry-run-test that can be set to restore
the previous behavior and updating the BuildSystem unit tests that depend on
that behavior to pass that flag.
2021-08-31 16:57:13 -07:00
Michael Gottesman
1d86a22f5b [build-script] Add a SKIP_XCODE_VERSION_CHECK to all dry-run build-script tests.
It makes sense to just set this here since we aren't testing that functionality
and enables us to test this if we aren't using one of the specified Xcodes
(which can be useful).
2021-08-31 14:10:28 -07:00
Butta
cec3e11207 [build][test] Don't test '--skip-clean-xctest' on Darwin as the source may not be checked out 2021-08-31 21:06:10 +05:30
Pavel Yaskevich
8e1e16778b Merge pull request #39096 from xedin/rdar-80271666-take-2
[ConstraintSystem] Allow IUO types to be unrelated while forming a di…
2021-08-31 01:02:23 -07:00
swift-ci
0c122a514f Merge pull request #38673 from buttaface/skip-clean 2021-08-30 16:27:14 -07:00
Pavel Yaskevich
c1269883b8 [ConstraintSystem] Allow IUO types to be unrelated while forming a disjunction
Detect situations when type of a declaration hasn't been resolved yet
(one-way constraints would use a type variable to represent a type of IUO pattern),
and use additional type variable and a constraint to represent an
object type of a future optional type.

Resolves: SR-14893
Resolves: rdar://80271666
2021-08-30 11:59:43 -07:00
Xi Ge
3616872c28 Merge pull request #39068 from nkcsgexi/73902734
ClangImporter: teach clang importer to import Clang SPI symbols and model them similarly as Swift SPIs
2021-08-28 14:20:25 -07:00
Xi Ge
36f25c3130 ClangImporter: teach clang importer to import Clang SPI symbols and model them similarly as Swift SPIs
For clang symbols marked with SPI_AVAILABLE, we add SPIAccessControlAttr to them so they will be
considered as SPIs in the AST. To be able to use all these symbols, we also add an implicit SPI import
statement for all clang modules. All clang SPIs belong to the same SPI group named "OBJC_DEFUALT_SPI_GROUP" because clang
currently doesn't support custom SPI group.

rdar://73902734
2021-08-28 11:11:09 -07:00
David Zarzycki
20f9be1f9a [testing] Add missing REQUIRES: standalone_build 2021-08-28 12:11:01 -04:00