forked from apple/swift
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge main 2021-04-15 #2986
Merged
Merged
Merge main 2021-04-15 #2986
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ch with a 'reasync' function This fixes a performance regression with the reasync '&&', '||' and '??' operators. Also arguably it makes sense anyway since 'reasync' functions can in fact be called from synchronous functions, so the solution should not be considered worse. We don't actually want to be able to overload a synchronous function with a 'reasync' function anyway; the whole point of 'reasync' is to avoid the need for such overloading. Fixes rdar://problem/76254445.
One last usage of getOldType() remains here, but it's actually meaningful since we want to handle InOutType there, so it will take more work to eliminate.
…ilability-checking`. This isn't an officially supported configuration, but is useful for testing and runtime development, and we shouldn't crash.
The actual fix is to perform qualified lookup on a TypeExpr in `collectPossibleCalleesForApply`. This changes the behaviour of some test cases in `complete_multiple_trailingclosure.swift`, which now provide argument labels. To make the choices suggested less verbose, I refined the parameter matching to only match trailing closures to parameters of function types. In `INIT_FALLBACK_1` we technically shouldn't be suggesting `arg3` based on the matched argument types (the closure returns `Int` and the constructor with `arg3` requires the closure to return `String`), but AFAICT we aren't doing type-checking at this stage, so there's no way to rule it out.
…ken in case stmt The last token in a case stmt can be a string literal token, which can *contain* its interpolation segments. If one of these interpolation segments is the reference point, we'd return false from `isReferencePointInRange` because the string literal token's start location is before the interpolation token. To fix this, adjust the range we are checking to range until the end of the string interpolation token. Fixes rdar://76330416 [SR-14455]
Due to apple#36552, parsing the code completion token as a type inside a generic parameter list no longer fails. Instead, it consumes the code completion token as a type identifier. However, since `parseExprIdentifer` does not return a `ParserStatus`, the information whether a code completion token was consumed gets lost, causing `setCodeCompletionDelayedDeclState` to not be called and thus no code completion results show up. To resolve this, make `parseExprIdentifier` return its `ParserStatus` through a `ParserResult`. Fixes rdar://76335452 [SR-14432]
Otherwise, the runtime needs to be able to adjust the instance size when nonfragile ObjC bases and/or resilient Swift bases are accounted for. rdar://54089488
Through various means, it is possible for a synchronous actor-isolated function to escape to another concurrency domain and be called from outside the actor. The problem existed previously, but has become far easier to trigger now that `@escaping` closures and local functions can be actor-isolated. Introduce runtime detection of such data races, where a synchronous actor-isolated function ends up being called from the wrong executor. Do this by emitting an executor check in actor-isolated synchronous functions, where we query the executor in thread-local storage and ensure that it is what we expect. If it isn't, the runtime complains. The runtime's complaints can be controlled with the environment variable `SWIFT_UNEXPECTED_EXECUTOR_LOG_LEVEL`: 0 - disable checking 1 - warn when a data race is detected 2 - error and abort when a data race is detected At an implementation level, this introduces a new concurrency runtime entry point `_checkExpectedExecutor` that checks the given executor (on which the function should always have been called) against the executor on which is called (which is in thread-local storage). There is a special carve-out here for `@MainActor` code, where we check against the OS's notion of "main thread" as well, so that `@MainActor` code can be called via (e.g.) the Dispatch library's `DispatchQueue.main.async`. The new SIL instruction `extract_executor` performs the lowering of an actor down to its executor, which is implicit in the `hop_to_executor` instruction. Extend the LowerHopToExecutor pass to perform said lowering.
…deploy. rdar://76564535
… fix for placeholders If left-hand side of a conversion that requires l-value is a placeholder type, let's fix that by propagating placeholder to the order side (to allow it to infer a placeholder if needed) without recording a fix since placeholder can be converted to `inout` and/or l-value and already indicates existence of a problem at some other spot in the expression. Resolves: rdar://76250381
An actor's deinit can be invoked from any thread, and does not (cannot!) synchronize to the actor. However, because "self" is by definition unique and cannot escape, don't perform data race checking in it or any local functions/closures within the initializer. This is an imperfect approximation, because one could introduce a data race by invoking a concurrent algorithm on "self" that does not escape the closure but subverts @sendable checking and concurrently accesses actor state. However, for the moment we accept this false negative because the false positives from performing this checking are much more prevalent.
Since 865e80f we are keeping track of internal closure labels in the closure’s type. With this change, wer are also serializing them to the swiftmodules. Furthermore, this change adjusts the printing behaviour to print the parameter labels in the swiftinterfaces. Resolves rdar://63633158
…ons." ... with a fix for a non-assert build crash: I used the wrong ilist type for SlabList. This does not explain the crash, though. What I think happened here is that llvm miscompiled and put the llvm_unreachable from the Slab's deleteNode function unconditionally into the SILModule destructor. Now by using simple_ilist, there is no need for a deleteNode at all.
…ations rdar://76567524 rdar://76567105
[Test] Disable tests that require new libswiftCore features for back deploy.
…-compat-hook Compatibility50: Use __dso_handle for cheaper main executable check.
…ss-layout-fixed IRGen: ObjC rodata can only go in __objc_const if layout is fixed.
rdar://76540446
…k_arm64_macos This test currently fails on macos arm64
…cking-assertion-failure SILGen: Don't crash when compiling `if #available` with `-disable-availability-checking`.
Reinstate "SIL: add a StackList data structure with zero cost operations."
…n-switch-case [CodeComplete] Fix issue with completion in string literal as last token in case stmt
…sure-name [Serialization] Serialize internal closure labels
[Sema] Adding a space in closure parameter destructuring fix in cases closure body is empty
Add missing `REQUIRES: concurrency`
…ync_task_yield [windows][test] Unsupport async_task_yield in OS=windows-msvc
…atorDisjunction`
…y-tests-linux [Test] Disable failing concurrency tests on Linux.
[Test] Disabled Interpreter/SDK/cf_without_foundation.swift on watchos.
…y some code. We have for a long time talked about creating a scope like data structure for use in the SILOptimizer. The discussion was whether or not to reuse the infrastructure in SILGen that does this already. There were concerns about doing so since the code in the SILOptimizer and SILGen can work differently. With that in mind, I added a small AssertingScope class and built on top of that a composition SIL level class called SILOptScope that one can use to add various cleanups. One is able to both destructively pop at end of scope and pop along early exits. At an implementation level, I kept it simple and: 1. Represented a scope as a stack of Optional<Cleanup> which are just a wrapper around a std::function. The Optional is so that we can invalidate a cleanup. 2. Based all of these scopes around the idea that the user of the scope must invalidate the scope by hand. If not, the scope object will assert at the end of its RAII scope. 3. Rather than creating a whole class hierarchy, I just used std::function closures to keep things simple.
…nicalizeInstruction into OwnershipOptUtils. This API is useful when writing compiler code that needs to handle ossa/non-ossa as well as load_borrow/load while in OSSA. I am going to use this in SILMem2Reg.
[Tests] NFC: Disable concurrency data race detection test on all plat…
Add location to the `sema_no_import_target` diagnostic
Per @xedin, it's fine to leave this test disabled here.
While ModuleDecl::lookupConformance() did the right thing here, we have another entry point, TypeChecker::containsProtocol(), that also needs to special-case Error. Fixes https://bugs.swift.org/browse/SR-13734 / rdar://problem/70338670.
…entification-logic [ConstraintSystem] NFC: Factor operator overload identification and partitioning.
…ype_checker_perf/fast/rdar26564101.swift
…5c892eb164aec334530 [ownership] Refactor out the composition type LoadOperation from CanonicalizeInstruction into OwnershipOptUtils.
…atype Sema: Handle Error self-conformance in TypeChecker::containsProtocol()
…77bc7eef73664feef8a [sil-mem2reg] Add a simple scope data structure and use it to simplify some code.
[ASTPrinter] Don't transform type if current type can't have members
MaxDesiatov
approved these changes
Apr 15, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.