Skip to content
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 2023-05-26 #5475

Merged
merged 77 commits into from
May 31, 2023
Merged

Merge main 2023-05-26 #5475

merged 77 commits into from
May 31, 2023

Conversation

kateinoigakukun
Copy link
Member

No description provided.

beccadax and others added 30 commits May 19, 2023 11:48
Sema now diagnoses @objcImpl implementations with:

• The wrong settability (i.e. a `let` used for a `readwrite` property)
• The wrong kind (i.e. a method used for a property)
… without type parameter packs

If function type of some declaration has a at least on type parameter
pack it could mean that number of parameters in "applied" type could
be different from that of "interface" type.
…ty matches

This covers situations like `Pack{repeat each T1, repeat each T2}`
vs. `Pack{repeat $T1, repeat $T2}` where type variables are allowed
to bind to packs.

Resolves: rdar://109539394
Introduce a new experimental feature `ASTGenTypes` that uses ASTGen to
translate the Swift syntax tree (produced by the new Swift parser)
into C++ `TypeRepr` nodes instead of having the C++ parser create the
nodes.

The approach here is to intercept the C++ parser's `parseType`
operation to find the Swift syntax node at the given position (where
the lexer currently is) and have ASTGen translate that into the
corresponding C++ AST node. Then, we spin the lexer forward to the
token immediately following the end of the syntax node and continue
parsing.
The pointers we were vending to C++ had low bits set because they were
AST node entries rather than the raw TypeReprs.
There is a modeling difference between the swift-syntax tree and the
C++ type representation (TypeRepr) that is a little odd here, so we
end up parsing the ellipsis on the C++ side rather than looking "up"
the syntax tree to find it.
Bridge the simple type attributes like `@autoclosure` into an
`AttributedTypeRepr`. We don't validate the arguments, and we don't
handle more complicated attributes like `@convention(c)` just yet.
Protocol composition types such as `P & Q` are similar to nested types
like `A.B` because the innermost type syntax node at the given position
doesn't cover the whole type. Adjust by looking back up the tree.
This all feels like a hack, and there should be a better way.

While here, fix the source ranges passed in to create
`CompositionTypeRepr`. We were tripping assertions due to missing
source-location information.
Instead of "spinning" the C++ lexer, consuming tokens uptil we get past
the point where ASTGen told us the end of the syntax node was, just
reset the lexer to exactly that position. This is more efficient, but
also fixes problems where we would end up skipping past a `>` that had
been split.
When `-unavailable-decl-optimization=complete` is specified, exclude
unavailable enum cases from the runtime layout of enums with payloads. Without
this, the type metadata for unavailable types may be referenced by enum cases
with unavailable payloads and cause linker failures.

Resolves rdar://107483852
apple#65253 (79e2697) made it so that the async and completion-handler variants of a member would both be matched by the same implementation, but the technique used composes poorly with typechecking work later in this series of commits. Reimplement it so that async variants are filtered out of `ObjCImplementationChecker::unmatchedRequirements` and then async candidates are compared against async alternatives later, during matching.
Check the types of @objcImpl candidates against their requirements and diagnose *most* mismatches.

Unlike typical type matching rules, @objcImpl allows an implementation’s parameter *and* result types to be an IUO when the requirement isn’t. This runs against the normal covariance rules in the case of the result type. It’s meant to allow an implementation to handle nils passed to it and return nils even if the declaration formally claims nils are not permitted; this is occasionally necessary to reimplement Objective-C APIs without breaking ABI compatibility.

Fixes rdar://102063730.
The swift driver emits extra newlines because it applies the LF ->
CRLF conversions again on the outpt from the child processes. Fix it
by using the binary mode when outputting the output from the child
processes.

Fixes: apple#64413
This is needed short term to allow the test to pass when running on
Python 3.11 and later and avoid errors like

```
<stdin>:44:1: note: non-matching line after previous match is here
<string>:1: DeprecationWarning: 'pipes' is deprecated and slated for removal in Python 3.13
^
```

Long term we want to replace uses of the obsolete `pipes.quotes`
function with `shlex.quotes`.

Addresses rdar://109664710
apple#66088)

* [ModuleInterface] Add mechanism to exclude experimental flags from the module interface

rdar://109722548

* Separate filtered flags from the typical/unfiltered case
kavon and others added 24 commits May 24, 2023 20:56
- refer to a "consuming use" as simply a "consume", to reserve "use" for non-consuming uses.
- refer to "non-consuming uses" as just a "use".
- don't call it a "user defined deinit" and instead a "deinitializer" to match Sema
- be specific about what binding a closure is capturing that is preventing consumption.

rdar://109281444
…more consistent word tense

sil_movekillscopyablevalue_* and sil_moveonlychecker_* can share diagnostics.

rdar://109281444
this also fixes a bug where sometimes we simply emit
'consumed here' twice and other times we'd said 'other
consume here' for the same "consumed more than once"
message. so I went through and changed all of the 2nd
consumes into "consumed again".

rdar://109281444
…anup

polish up the noncopyable diagnostics
…lings-go-faster

[Runtime] Fast lookups of Concurrency types with standard manglings.
[Runtime] Skip metadata records search for classes in the __C module.
rdar://109790722

Layout strings are not guaranteed to be properly aligned, so we can't directly read from and write to it, but have to use memcpy instead.
[NFC] Use method for more @objcImpl diagnostics
[stdlib] don't copy array contents on `removeAll(keepingCapacity: true)`
Emit updated debug info when inout parameters are consumed and reinitialized.
…OF_PROCESSORS

Support NUMBER_OF_PROCESSORS not being defined when running tests on Windows
Fix case mismatch in test error message expectation
[DiscardingTG] Undo pointer auth workaround; fix memory leaks
@kateinoigakukun kateinoigakukun marked this pull request as ready for review May 26, 2023 16:25
… Void closure

Since apple#65613, DiscardingTG started to
accept `() -> Void` instead of `() -> T`, but it also changed the number
of arguments accepted by the closure from 3 to 2. So it should use
`non_future_adapter` instead of `future_adapter` to avoid runtime signature
mismatch.
@kateinoigakukun kateinoigakukun merged commit 61e1384 into swiftwasm May 31, 2023
8 of 9 checks passed
@kateinoigakukun kateinoigakukun deleted the katei/merge-main-2023-05-26 branch June 29, 2023 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet