Commit Graph

1081 Commits

Author SHA1 Message Date
Anthony Latsis
6e8dcbe745 ConformanceChecker: Resolve value witnesses unless they depend on invalid type witnesses 2022-02-26 01:06:53 +03:00
Slava Pestov
561e63552f Pass -requirement-machine-protocol-signatures=off in three tests 2022-02-24 15:09:53 -05:00
Slava Pestov
54bf6adb58 Revert "Sema: Don't resolve protocol typealiases to DependentMemberTypes"
This reverts commit 1dd79ae3db.

Fixes rdar://problem/88230388.
2022-02-23 23:11:05 -05:00
Slava Pestov
250fbf2f3d Sema: Reject 'any P' in inheritance clauses 2022-02-23 23:10:10 -05:00
Anthony Latsis
2342712ca0 [NFC] Reorganize a few SE-309 test cases with opaque result types 2022-02-23 10:24:54 +03:00
Anthony Latsis
88dc3ad3fa Sema: Fix interface type computation for observer parameters 2022-02-23 10:24:54 +03:00
Anthony Latsis
f239dbcf54 [SE-309] CSDiag: Add a fix-it that replaces an existential parameter type with its generic equivalent 2022-02-23 10:24:54 +03:00
Anthony Latsis
d36aecca49 Diag: Make 'could_not_use_member_on_existential' less assertive 2022-02-23 10:24:51 +03:00
Anthony Latsis
b0043966cd Merge pull request #40269 from AnthonyLatsis/assoc-inference-system
AssociatedTypeInference: Initial refactoring of abstract type witness inference
2022-02-20 15:51:58 +03:00
Doug Gregor
fa6c3c15d8 Opaque types are only invariant when they involve same-type constraints.
An opaque type is only invariant with respect to the existential Self
when the constraints on the opaque type involve Self. Such constraints
are not expressible in the type-erased value, so treat them as
invariant. This loosens the restriction on using members of protocol
type that return an opaque type, such that (e.g.) the following is
still well-formed:

    protocol P { }
    protocol Q { }

    extension P {
      func getQ() -> some Q { ... }
    }

    func test(p: any P) {
      let q = p.getQ() // formerly an error, now returns an "any Q"
    }

However, this does not permit uses of members such as:

    extension P {
      func getCollection() -> some Collection<Self> { ... } // error
    }

because the type system cannot express the corresponding existential
type `any Collection<Self>`.
2022-02-18 11:22:56 -08:00
Anthony Latsis
2ebb123421 AssociatedTypeInference: Properly substitute into tentative type witnesses in inferAbstractTypeWitnesses()
A regular type.subst() is not enough, because tentative type witnesses may contain type parameters,
and we have to substitute them as well, recursively, e.g A := G<B>, B := G<C>, C := Never. Avoiding
subst() here also eliminates a use case of the getSubstOptionsWithCurrentTypeWitnesses() hack.
2022-02-16 00:56:09 +03:00
Anthony Latsis
789f90d7f6 TypeWitnessSystem: Handle ambiguities
Since we collect same-type constraints by scanning requirement signatures,
the type witness system must be prerared to face conflicting solutions
for a particular type witness
2022-02-16 00:56:09 +03:00
Anthony Latsis
4c68ecfdf5 TypeWitnessSystem: Add tests 2022-02-16 00:56:08 +03:00
Slava Pestov
4655fc359b Sema: Make a couple of TypeResolver methods idempotent
When emitting a diagnostic, mark the TypeRepr as invalid and
return an ErrorType to ensure that the diagnostic is not
emitted again, and to muffle downstream diagnostics.
2022-02-15 04:02:46 -05:00
Slava Pestov
5fa5ff7ce1 RequirementMachine: Update tests for protocol typealiases 2022-02-13 09:50:16 -05:00
Slava Pestov
6c714f4087 Sema: Try to avoid calling getGenericSignature() when performing structural resolution 2022-02-11 08:15:50 -05:00
Becca Royal-Gordon
74dc00f091 Merge pull request #40677 from beccadax/sendable-to-the-whole-block
[ClangImporter] Make completion handlers Sendable
2022-02-04 14:51:21 -08:00
Anthony Latsis
c7fd60f2dd Merge pull request #39492 from AnthonyLatsis/se-309-2
SE-309: Covariant erasure for dependent member types
2022-02-02 07:07:17 +03:00
Anthony Latsis
e849375082 [NFC] Rename some test files 2022-02-02 02:10:05 +03:00
Anthony Latsis
57e806452a Sema: Use the type of the closed existential in 'unused expression' diagnostics 2022-02-02 02:10:05 +03:00
Anthony Latsis
24c19d4ad4 Sema: Enable covariant erasure for dependent member types 2022-02-02 02:10:05 +03:00
Anthony Latsis
c47f99a22d Diag: Use 'Self'-rooted interface types instead of opened archetypes in requirement failure messages 2022-02-02 02:10:05 +03:00
Anthony Latsis
8e0e4146b2 Diag: Silence argument mismatch failures in unsupported existential member accesses 2022-02-02 02:10:05 +03:00
Anthony Latsis
b3ee4b0718 AST, Sema: Use the opened archetype's generic signature to determine existential member availability 2022-02-02 02:09:59 +03:00
Anthony Latsis
756bf30eeb GenericEnvironment: Don't use the existential layout's protocols to build "nested" opened archetypes 2022-02-01 23:00:55 +03:00
Anthony Latsis
427190d348 Sema: Handle generic-signature-based existential availability 2022-02-01 20:55:46 +03:00
Pavel Yaskevich
9ea2f96fd0 Merge pull request #41101 from xedin/load-witness-tables-for-decodeNextArgument
[Distributed] Augment distributed accessor to lookup witness tables for decode call
2022-01-31 09:33:58 -08:00
Doug Gregor
ea997a0f60 Merge pull request #41103 from DougGregor/unchecked-sendable-other-file
Ensure that we warn about non-local non-@unchecked Sendable conformances
2022-01-31 08:52:03 -08:00
Pavel Yaskevich
d5c9a4b5b3 [Distributed] NFC: Add SerializationRequirement conformance to decoder in tests 2022-01-31 00:37:59 -08:00
Doug Gregor
cd5145921e Ensure that we warn about non-local non-@unchecked Sendable conformances. 2022-01-30 23:55:39 -08:00
Pavel Yaskevich
c3cafcc1ab [Distributed] NFC: Split FakeInvocation into Encoder and Decoder and adjust tests 2022-01-29 14:33:41 -08:00
swift-ci
3e228bdaca Merge pull request #41056 from ktoso/wip-roundtrip 2022-01-28 06:45:07 -08:00
Konrad `ktoso` Malawski
6a0164d16f [Distributed] Reuse fake actor systems more in tests 2022-01-28 21:21:08 +09:00
Konrad `ktoso` Malawski
89b0a4ce89 Merge pull request #41036 from ktoso/wip-distributed-remove-dynamic-sil-remotecall-squashed
[Distributed] Remove @_dynamic replacements; impl remoteCall ad-hoc reqs
2022-01-28 11:13:34 +09:00
Konrad `ktoso` Malawski
4bf2a92bda [Distributed] Remove @_dynamic replacements; impl remoteCall ad-hoc reqs
Squashed commit of the following:

commit e5a05ffe44
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 17:45:31 2022 +0900

    cleanup

commit 1f751cea5a
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 14:50:33 2022 +0900

    cleanups

commit c632f3215d
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 14:01:09 2022 +0900

    add test for generic from actor decl

commit 09b8bd50a7
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 14:00:58 2022 +0900

    cleanups

commit 31f4d0cffd
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 27 11:40:51 2022 +0900

    fix test

commit ad4db2fb6c
Merge: 97227edcca 07e2dfda56
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 26 23:31:41 2022 +0900

    Merge branch 'main' into wip-zzz

commit 97227edcca
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 26 21:01:25 2022 +0900

    remove @_dynamic methods!

    fix tests

commit 1c79344dbb
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 19 12:51:09 2022 +0900

    cleanup

    wip

    stuck

    fixed the stack cleanups

    cleanups pretty good now

    weird load

    rki

    works

    remove hack

    add take + throw + return

    fix test

    more tests fixed

    more tests fixed

    more tests fixed

commit 3ed494c175
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Jan 18 21:09:28 2022 +0900

    stack issues in SIL verification

commit 5cf43a7f86
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Jan 18 09:19:51 2022 +0900

    about to call the remoteCall

    goot to return, but missing subs

commit df8e47122a
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 13 14:09:49 2022 +0900

    [Distributed] Refactor Invocation to Decoder/Encoder

    getting there

    done-recording

    working on the string init

    stuck trying to get String initializer SILFunction

    created the remote call target

commit fc7bd62f32
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 23:01:14 2022 +0900

    [Distributed] Pass arguments from Invocation to HBuffer

commit cafc2cc058
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 22:08:47 2022 +0900

    works

commit a7d01837ff
Author: Pavel Yaskevich <pyaskevich@apple.com>
Date:   Tue Jan 11 15:48:58 2022 -0800

    [Distributed] Adjust interface of `swift_distributed_execute_target`

    Since this is a special function, `calleeContext` doesn't point to
    a direct parent but instead both parent context (uninitialized)
    and resume function are passed as last arguments which means that
    `callContext` has to act as an intermediate context in call to accessor.

commit c1f830be27
Author: Pavel Yaskevich <pyaskevich@apple.com>
Date:   Tue Jan 11 17:00:08 2022 -0800

    [Distributed] Drop optionality from result buffer in `_executeDistributedTarget`

    `RawPointer?` is lowered into a two arguments since it's a struct,
    to make it easy let's just allocate an empty pointer for `Void` result.

commit c83c2c37b6
Author: Pavel Yaskevich <pyaskevich@apple.com>
Date:   Tue Jan 11 17:02:45 2022 -0800

    [Distributed] NFC: Update _remoteCall test-case to check multiple different result types

commit 29e7cf50e4
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 21:32:37 2022 +0900

    wip

commit 9128ecc6f8
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 20:46:20 2022 +0900

    wip

commit a6b2a62a67
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 20:38:22 2022 +0900

    wip

commit 8b188f0d43
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 16:55:10 2022 +0900

    wip

commit 3796bec2b9
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Jan 12 16:55:02 2022 +0900

    wip

commit 0ffc68b5ef
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Jan 11 21:44:58 2022 +0900

    [Distributed] Implementing ad-hoc protocol requirements

commit 78862575e4
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 6 18:03:54 2022 +0900

    cleanup

commit 5f4ab89e25
Merge: 24a628e7c0 fdda6f2ee4
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 6 15:51:39 2022 +0900

    Merge branch 'main' into wip-impl-execute-swift

commit 24a628e7c0
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Thu Jan 6 15:33:21 2022 +0900

    wip

commit 69e7fed09d
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Dec 22 06:36:45 2021 +0900

    [Distributed] comment out distributed_actor_remoteCall for now

commit 376733a9f6
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Tue Dec 21 16:00:06 2021 +0900

    reimplement distributed get type info impls

commit 74ab47886a
Author: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
Date:   Wed Dec 15 21:37:08 2021 +0900

    [Distributed] Implement func metadata and executeDistributedTarget

    dont expose new entrypoints

    able to get all the way to calling _execute
2022-01-27 17:51:43 +09:00
Robert Widmann
5cff292ad7 Merge pull request #41005 from CodaFi/stubbed-toe
Propagate Qualified Type Printing in Ambiguous Situations In More Cases
2022-01-26 21:47:12 -08:00
Slava Pestov
f33eb17b75 GSB: Remove unsound cycle-breaking hack 2022-01-25 21:28:52 -05:00
Becca Royal-Gordon
602fb3f3d0 Allow @Sendable contravariance in witness params
If a requirement calls for a parameter's function type to be @Sendable, Swift will now permit a witness that does *not* make that parameter @Sendable. This is fine because @Sendable does not affect the calling convention and the witness may not need to exploit the opportunity to send the closure anywhere.

In other words, this code is now valid:

```
protocol P {
    func fn(_: @Sendable () -> Void)
}
struct S: P {
    func fn(_: () -> Void)
}
```

There's an edge case where this still isn't allowed when an associated type is @Sendable.
2022-01-25 15:49:54 -08:00
Robert Widmann
d5c226d55f Propagate Qualified Type Printing in Ambiguous Situations In More Cases
Ultimately this is to support the disambiguation of protocol requirements when printing stubs. This allows us to disambiguate the case where two modules declare a nominal type, and when that type appears in a protocol requirement. In such a case, we now fully qualify the types involved.

Fixing this also appears to now be consistently printing module qualification in many more places, hence the updates to the IDE/SourceKit tests.

rdar://72830118
2022-01-25 14:03:11 -08:00
Anthony Latsis
6b5de4909d Merge pull request #40980 from AnthonyLatsis/swiftui-warning-hack
Sema: Tighten up SwiftUI conformance hack and add a warning
2022-01-25 14:40:13 +03:00
Anthony Latsis
0eb7eaa43b Sema: Tighten up SwiftUI conformance hack and add a warning 2022-01-25 11:36:18 +03:00
Slava Pestov
e4973158d8 AST: -debug-generic-signatures protocol-qualifies DependentMemberTypes 2022-01-19 22:36:15 -05:00
Holly Borla
ee331a8c01 [Type System] Enable explicit existential types. 2022-01-13 19:31:35 -08:00
swift-ci
81cd88948d Merge pull request #40816 from ktoso/distributed-invocation-params 2022-01-13 08:22:46 -08:00
Konrad `ktoso` Malawski
ef14ff15e8 [Distributed] Refactor Invocation to Decoder/Encoder 2022-01-13 18:27:18 +09:00
LucianoAlmeida
4a881739a6 [Diagnostics][Sema] Improving wording same type is check 2022-01-11 22:46:23 -03:00
Thanh-Nhon NGUYEN
e06093f194 Fixed typo: struct -> enum 2022-01-05 13:26:11 +01:00
Anthony Latsis
877f68d491 Merge pull request #39137 from AnthonyLatsis/deoptimize 2021-12-18 10:50:00 +03:00
Robert Widmann
6f68210fb2 Use the API Name of Enum Parameters to Determine Coding Keys
Covers a missing case in codable synthesis for enums with argument
payloads that have internal and external labels. When the name of the
var decl is used, the internal name of the parameter becomes the key
instead of the API name. In this case, this causes an invalid reference
to an enum case with the internal name as an argument to be synthesized
in the derived Decodable conformance which (hopefully) crashes
downstream.

rdar://86339848
2021-12-16 13:02:35 -08:00
Slava Pestov
1dd79ae3db Sema: Don't resolve protocol typealiases to DependentMemberTypes 2021-12-14 19:45:34 -05:00