Commit Graph

7754 Commits

Author SHA1 Message Date
Pavel Yaskevich
4e3a4ffbe9 Merge pull request #62120 from xedin/rdar-100753270
[CSSyntaxElement] Detect type variables in sequence expressions of `for-in` loops
2022-11-17 09:54:22 -08:00
Dario Rexin
f63de71001 Merge pull request #38507 from drexin/wip-llvm-build-script
[Build] Make LLVM a build-script product
2022-11-16 20:44:13 -08:00
Pavel Yaskevich
7bc1dc59ab [AST] getParameterAt should check index before retrieving it
`getParameterAt` needs to be more defensive about the input
because caller cannot always perform all the checks upfront.

Resolves: rdar://102085039
2022-11-16 15:34:05 -08:00
Pavel Yaskevich
cab0cb52ab [CSSyntaxElement] Detect type variables in sequence expressions of for-in loops
Invalid syntax could introduce type variables into sequence which
have to be brought into scope otherwise solver is going to crash.

Resolves: rdar://100753270
2022-11-15 11:56:36 -08:00
Holly Borla
0708e0efd4 Revert "Tests: Disable failing SwiftUI validation tests" 2022-11-15 09:10:23 -08:00
Slava Pestov
34c9daa635 Merge pull request #62076 from slavapestov/no-assert-test-hang-fix
Disable 0022-rdar21625478.swift entirely on noassert builds
2022-11-14 19:52:45 -05:00
Allan Shortlidge
b2421aa463 Tests: Disable failing SwiftUI validation tests until rdar://102298208 is fixed. 2022-11-13 16:56:20 -08:00
Slava Pestov
abfe49fd3d Disable 0022-rdar21625478.swift entirely on noassert builds
Fixes rdar://problem/99800538.
2022-11-11 23:31:06 -05:00
Pavel Yaskevich
0a75a07962 [CSSolver] Don't drop bindings with type variables while applying solutions
If a (partial) solution has a type variable it could only be unbound
if `FreeTypeVariableBinding` is set to `Allow`, in all other cases
solution would either have a fully resolved type or a hole.

`applySolution` shouldn't second guess `finalize()` and just apply
a solution as given. This is very important for multi-statement closures
because their elements are solved in isolation and opaque value types
inferred for their result could contain not-yet-resolved type variables
 from outer context in their substitution maps (which it totally legal
under bi-directional inference).
2022-11-10 10:12:38 -08:00
Nuri Amari
48604ca729 Merge pull request #61819 from NuriAmari/remote-ast-runtime-type-mismatch
Fix issues with runtime reporting incorrect types for nested generics
2022-11-07 14:01:38 -08:00
Nuri Amari
66f993194a Fix issues with runtime reporting incorrect types for nested generics
Fixes: https://github.com/apple/swift/issues/60565
2022-11-04 09:43:26 -07:00
Augusto Noronha
352c4c209a Merge pull request #61837 from augusto2112/reflect-optional-bool
Implement reading extra inhabitants of integers
2022-11-03 09:38:25 -07:00
Augusto Noronha
2ae06446a4 Add the reflect_Optional_Bool validation test
Bools are special in that they only need 1 bit of storage, and have many
extra inhabitants available. This adds a test to check that an optional
whose payload is a bool is reflected correctly.
2022-11-02 10:20:24 -07:00
Alsey Coleman Miller
62b7be4e9c [stdlib] Add RISCV64 support 2022-11-01 23:59:42 -07:00
Dario Rexin
3f80cb6712 [Build] Make LLVM a build-script product
rdar://80733826
2022-10-30 22:47:29 -07:00
Arnold Schwaighofer
411b3d2f18 Merge pull request #61750 from aschwaighofer/use_clang_for_protocol_irgen
IRGen: Use clang's codegen for protocol decls
2022-10-28 08:46:08 -07:00
Pavel Yaskevich
e3cd2abdec Merge pull request #61778 from xedin/rdar-98862079
[Diagnostics] Diagnose type with mismatching generic arguments in ternary expr
2022-10-27 19:07:47 -07:00
Pavel Yaskevich
8ab37ca449 [Diagnostics] Diagnose type with mismatching generic arguments in ternary expr
Fixes a missing diagnostic related to types with mismatched
generic arguments in one of both ternary branches.

Resolves: rdar://98862079
2022-10-27 15:56:50 -07:00
Nate Chandler
ed623d7b64 [NFC] Shortened SIL [init] flag.
Instead of writing out [initalization] for some instructions, use [init]
everywhere.
2022-10-27 10:38:54 -07:00
Arnold Schwaighofer
ba9578d6ce IRGen: Use clang's codegen for protocol decls
There are certain protocol method decls types that swift does not import
today.

```
@protocol Incomplete
- (id)getObjectFromVarArgs:(id)first, ...;
@end
```

Furthermore, the old method also emitted duplicate entries for protocols
methods when Swift synthesized methods for diagnosics.

We won't import this method into Swift. So if we emit protocol metadata
from swift delcs we would generate incomplete records.

rdar://60888524
2022-10-26 12:34:25 -07:00
Mike Ash
4945a56344 [Reflection] Put a recursion limit on readTypeFromMetadata.
We can end up with a stack overflow if we encounter a very deeply nested type, or bad data that looks like one. Fail gracefully for types that are nested beyond a limit. By default, the limit is 50.

rdar://100847548
2022-10-25 10:35:51 -04:00
Anthony Latsis
d977dd101f Merge pull request #61469 from AnthonyLatsis/verify-bugs
tests: Address a few stale FIXMEs & replace some commented-out test cases with verifications
2022-10-10 15:16:49 +03:00
Becca Royal-Gordon
f66d5cd9cf Merge pull request #61463 from beccadax/lint-trap
Move Python linting to primary tests
2022-10-07 13:57:35 -07:00
Evan Wilde
64b19f7f45 Backdeploy task_wait_future fix to Swift 5.6 (#61254)
* Backdeploy swift_task_future_wait

This patch adds the implementation for `swift_task_future_wait`
entrypoint to the backdeploy library.

This involves pulling in `AsyncTask::waitFuture`, which relies on a fair
bit.

Please note, this pulls in the `StaticMutex` implementation from Swift
5.6. There are some challenges here. The concurrency version of the
`StaticMutex` involves a fairly nasty set of ODR violations in the
normal setup. See `public/Concurrency/Mutex.cpp`, which includes the
Mutex implementations cpp files directly, while defining a single macro
to replace the implementation of swift::fatalError with
swift_concurrency_fatalError. We only need the concurrency mutex (at
least for now), so I have hard-coded the `swift_concurrency_fatalError`
version into this library. If we should need the other implementation,
we are forced to include ODR-related undefined behavior.

We need symbols from C++, so I've added an implicit linker flag whenever
the static library is used, namely, it passes `-lc++` to the linker.
Since we only backdeploy on Apple platforms, this should be fine.

Some of the platform runtimes we need to backdeploy to have the
enter/exitThreadLocalContext functions defined, while others don't. We
define our own backdeploy56 shim function that dlsym's the function
pointer for these symbols if we have exclusivity checking available.
Otherwise, it doesn't do anything. If concurrency exclusivity checking
is available, we'll use it, otherwise we wont'.

The same dlsym check is done for `swift_task_escalate`. Not all
platforms we need to backdeploy to have a concurrency runtime. The
symbols that do need to use pieces of the concurrency runtime should not
be getting hit when deploying to systems that don't have concurrency. In
the event that you've gotten around the language blocking you from
calling these symbols and you've managed to call concurrency pieces
without using concurrency, we'll abort because something is seriously
wrong.

* Backdeploy swift_task_future_wait_throwing

Drop the remaining pieces in for adding
`swift_task_future_wait_throwing`.

* Apply task_wait_future fix

Actually apply the fix from ef80a315f8.

This deviates slightly from the original patch.

AsyncTask::PrivateStorage::_Status() does not exist in the Swift 5.6
library. Instead I am using `AsyncTask::PrivateStorage::Status`.

* Workaround missing compiler-rt linking

Working around the missing link against compiler-rt in these test.
They are a bit brittle as if anything in them uses compiler-rt, they
will start failing. The backdeploy 5.6 library uses some symbols from
compiler-rt, thus causes them to fail to link.

Disabling the runtime compatibility version checking to avoid these
symbols. This should be fine for the MicroStdlib test, but we should fix
'%target-ld' to handle this better in the future.
rdar://100868842
2022-10-07 09:36:17 -07:00
Anthony Latsis
6637c18954 Address a few stale FIXMEs & replace some commented-out test cases with verifications 2022-10-06 16:39:18 +03:00
Becca Royal-Gordon
1cc7e3b72c Move Python linting to primary tests
This will make it more likely that contributors discover Python style mistakes at their desks instead of in Swift CI.
2022-10-05 16:19:04 -07:00
Pavel Yaskevich
6c518bd311 Merge pull request #61388 from xedin/support-closures-with-implicitly-wrapped-params
[CSClosure] Don't try to infer types for implicitly wrapped parameters
2022-10-03 09:14:17 -07:00
Doug Gregor
e7b107b53e Ensure that there is a syntax error even with lazy parsing.
Without any syntax errors prior to lazy parsing, we'll reject this in
valid-parse testing of the new parser. Adding this doesn't change the
fundamental nature of this test.
2022-09-30 14:27:36 -07:00
Pavel Yaskevich
77f9c01b77 [CSClosure] Don't try to infer types for implicitly wrapped parameters
Update `applyPropertyWrapperToParameter` to set types to projected
and wrapped values and allow `TypeVariableRefFinder` to skip decls
with implicit property wrappers that are not yet resolved.
2022-09-30 12:53:01 -07:00
Anthony Latsis
e1d1760c87 Merge pull request #61141 from AnthonyLatsis/migrate-test-suite-to-gh-issues-28
Gardening: Migrate test suite to GH issues p. 28
2022-09-29 10:01:18 +03:00
Anthony Latsis
c55218d0e8 Merge pull request #61132 from AnthonyLatsis/migrate-test-suite-to-gh-issues-27
Gardening: Migrate test suite to GH issues p. 27
2022-09-28 05:10:40 +03:00
Anthony Latsis
34f78b2f8e Gardening: Migrate test suite to GH issues: validation-test/compiler_crashers_2_fixed (4/4) 2022-09-27 23:44:12 +03:00
Anthony Latsis
24ac121da1 Gardening: Migrate test suite to GH issues: validation-test/compiler_crashers_2_fixed (3/4) 2022-09-27 23:44:05 +03:00
Anthony Latsis
3304744698 Merge pull request #61130 from AnthonyLatsis/migrate-test-suite-to-gh-issues-26
Gardening: Migrate test suite to GH issues p. 26
2022-09-27 08:01:51 +03:00
Anthony Latsis
06195573f2 Gardening: Migrate test suite to GH issues: validation-test/compiler_crashers_2_fixed (2/4) 2022-09-27 03:14:58 +03:00
Anthony Latsis
2577af7967 Gardening: Migrate test suite to GH issues: validation-test/compiler_crashers_2_fixed (1/4) 2022-09-27 03:14:39 +03:00
Anthony Latsis
73b6784946 Gardening: Migrate test suite to GH issues: validation-test/stdlib 2022-09-20 02:32:29 +03:00
Anthony Latsis
42e47d74f5 Gardening: Migrate test suite to GH issues: validation-test/SILOptimizer 2022-09-20 02:32:29 +03:00
Anthony Latsis
6192ffde27 Gardening: Migrate test suite to GH issues: validation-test/SIL 2022-09-20 02:32:29 +03:00
Anthony Latsis
1e2f6bbbfa Gardening: Migrate test suite to GH issues: validation-test/Serialization (2/2) 2022-09-20 02:32:18 +03:00
Anthony Latsis
456a8debee Gardening: Migrate test suite to GH issues: validation-test/Serialization (1/2) 2022-09-20 02:31:46 +03:00
Anthony Latsis
7778505bc6 Gardening: Migrate test suite to GH issues: validation-test/Sema (2/2) 2022-09-19 23:12:45 +03:00
Anthony Latsis
26791bc21e Gardening: Migrate test suite to GH issues: validation-test/Sema (1/2) 2022-09-19 23:12:12 +03:00
Anthony Latsis
b2f386d521 Gardening: Migrate test suite to GH issues: validation-test/Runtime 2022-09-19 22:58:06 +03:00
Anthony Latsis
e52618ee34 Gardening: Migrate test suite to GH issues: validation-test/IRGen 2022-09-19 22:52:07 +03:00
Anthony Latsis
afb1eecb3e Gardening: Migrate test suite to GH issues: validation-test/IDE 2022-09-19 22:47:19 +03:00
Anthony Latsis
763df189e5 Gardening: Migrate test suite to GH issues: validation-test/execution 2022-09-19 22:35:26 +03:00
Anthony Latsis
3fcadf6c15 Gardening: Migrate test suite to GH issues: validation-test/Evolution 2022-09-19 22:34:06 +03:00
Anthony Latsis
25e42ca56c Gardening: Migrate test suite to GH issues: validation-test/compiler_crashers_fixed 2022-09-19 22:34:06 +03:00
Anthony Latsis
d024dc363f Gardening: Migrate test suite to GH issues: validation-test/compiler_crashers_2 2022-09-19 22:33:48 +03:00