Commit Graph

1923 Commits

Author SHA1 Message Date
Slava Pestov
b201d482f4 Merge pull request #39015 from slavapestov/override-generics-checking
Sema: Fix generics invariant violations in override checking
2021-08-24 14:32:55 -04:00
swift-ci
2d774b0fdc Merge remote-tracking branch 'origin/main' into rebranch 2021-08-24 01:14:28 -07:00
Konrad `ktoso` Malawski
c916c0a394 [Distributed] decode init for DistributedActor (#38998)
* Revert "Revert "Merge pull request #38938 from drexin/wip-dist-resolve" (#38994)"

This reverts commit f6ae9f3387.

* [Distributed] decode init for DistributedActor
2021-08-24 17:00:58 +09:00
Slava Pestov
7c29aaf3e2 Sema: Fix generics invariant violations in override checking
Override checking checks if the derived declaration's generic
signature is compatible with the base, but it does this after
doing a bunch of other checks which feed potentially invalid
type parameters to generic signature queries.

Now that the requirement machine is stricter about this kind
of this, re-organize some code to get around this.

Unfortunately this regresses a diagnostic, because we reject
candidates with mismatched generic requirements earlier in
the process.
2021-08-23 21:52:55 -04:00
swift-ci
c74499c1e4 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-20 11:14:10 -07:00
Becca Royal-Gordon
c517b45bb4 Merge pull request #38948 from beccadax/the-copypasta-is-stale
[NFC] Factor out ASTContext `operator new`s
2021-08-20 11:04:56 -07:00
Becca Royal-Gordon
59bb325e4b [NFC] Factor out ASTContext operator news
Many, many, many types in the Swift compiler are intended to only be allocated in the ASTContext. We have previously implemented this by writing several `operator new` and `operator delete` implementations into these types. Factor those out into a new base class instead.
2021-08-19 11:19:52 -07:00
swift-ci
a24a4f0339 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-12 06:13:43 -07:00
Konrad `ktoso` Malawski
e1dcd776c5 [Distributed] Implement assigning address in SIL 2021-08-12 14:04:50 +09:00
swift-ci
8e11ea0ae8 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-06 16:13:41 -07:00
Robert Widmann
592e90af9b Add Sugar for Variadics
We used to represent the interface type of variadic parameters directly
with ArraySliceType. This was awfully convenient for the constraint
solver since it could just canonicalize and open [T] to Array<$T>
wherever it saw a variadic parameter. However, this both destroys the
sugaring of T... and locks the representation to Array<T>. In the
interest of generalizing this in the future, introduce
VariadicSequenceType. For now, it canonicalizes to Array<T> just like
the old representation. But, as you can guess, this is a new staging
point for teaching the solver how to munge variadic generic type bindings.

rdar://81628287
2021-08-06 12:51:39 -07:00
swift-ci
f5abfc2c53 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-05 18:54:12 -07:00
Arnold Schwaighofer
5a83172a55 Merge remote-tracking branch 'upstream/main' into rebranch 2021-08-05 12:04:56 -07:00
Slava Pestov
6dc9ef88d7 AST: GenericSignatures don't contain type variables 2021-08-05 14:39:07 -04:00
willtunnels
319b3e64aa Add support for opaque result types in structural positions (#38392)
* [TypeResolver][TypeChecker] Add support for structural opaque result types

* [TypeResolver][TypeChecker] Clean up changes that add structural opaque result types
2021-08-03 23:45:02 -04:00
Doug Gregor
c79fa23339 Implicitly build "missing" conformances to Sendable.
When looking up a conformance to Sendable fails, implicitly create a
"missing" builtin conformance. Such conformances allow type checking
to continue even in the presence of Sendable-related problems.

Diagnose these missing conformances when they are used in an actual
program, as part of availability checking for conformances and when we
are determining Sendability. This allows us to decide between an
error, a warning, and suppressing the diagnostic entirely without
affecting how the program is compiled. This is a step toward enabling
selective enforcement of Sendable.

Part of rdar://78269348.
2021-08-02 16:16:59 -07:00
Slava Pestov
d3b6bff53f Sema: Dance around to avoid re-entrant RequirementMachine construction 2021-07-31 23:51:35 -04:00
Artem Chikin
ad7dbc5388 Merge pull request #38703 from artemcm/DepScanCacheSearchPathDisambiguate
[Dependency Scanning] Have the scanner cache answer queries relevant to current search paths only.
2021-07-30 14:45:28 -07:00
Artem Chikin
6a12dc0070 [Dependency Scanning] Have the scanner cache answer queries relevant to current search paths only.
The dependency scanner's cache persists across different queries and answering a subsequent query's module lookup with a module not in the query's search path is not correct.

For example, suppose we are looking for a Swift module `Foo` with a set of search paths `SP`.
And dependency scanner cache already contains a module `Foo`, for which we found an interface file at location `L`. If `L`∉`SP`, then we cannot re-use the cached entry because we’d be resolving the scanning query to a filesystem location that the current scanning context is not aware of.

Resolves rdar://81175942
2021-07-30 09:53:04 -07:00
swift-ci
ecd2566295 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-29 05:53:06 -07:00
Hamish Knight
ebdae7ca00 Merge pull request #38504 from hamishknight/construction-site 2021-07-29 13:43:12 +01:00
Hamish Knight
df566e3147 [AST] Rename decomposeInput/composeInput
Explicitly call out the fact we're dealing with
tuples.
2021-07-28 23:14:45 +01:00
swift-ci
1fc44750c3 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-28 13:54:07 -07:00
Doug Gregor
ecd830e342 Rework BuiltinProtocolConformance to be more like NormalProtocolConformance.
Give BuiltinProtocolConformance a generic signature, which can be used to
describe the generic parameters used within the builtin conformance, e.g.,
`<T1, T2, T3>` for a tuple type `(T1, T2, T3)`. Also store the
conditional requirements as trailing objects, requiring them to be
precomputed by whatever builds the conformances. Together, this means
that builtin protocol conformances act like normal conformances with
respect to conditional requirements and substitutions: they will be
defined generically, then a specialized conformance will be layered on
top to provide the substitutions.
2021-07-27 23:49:27 -07:00
Azoy
20cc067844 [AST] Introduce BuiltinProtocolConformance 2021-07-27 23:49:27 -07:00
swift-ci
0237024788 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-23 18:34:11 -07:00
Slava Pestov
212099be82 RequirementMachine: Move RequirementMachine class to swift::rewriting namespace 2021-07-23 17:21:58 -04:00
Slava Pestov
379359c08e RequirementMachine: Move RequirementMachine.h to lib/AST/RequirementMachine 2021-07-23 17:21:57 -04:00
swift-ci
fd87ebc401 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-23 07:13:34 -07:00
Robert Widmann
1329f3cfbd [NFC] Lift getGenericEnvironment() into GenericSignature 2021-07-22 23:33:02 -07:00
Robert Widmann
74b653518d Lift GenericSignature::hasTypeVariable 2021-07-22 23:27:06 -07:00
Robert Widmann
a0615e9848 [NFC] Use GenericSIgnature::getGanonicalSignature Where Possible 2021-07-22 23:27:06 -07:00
Robert Widmann
1491eb0ca3 [NFC] Drop Some Superfluous Null Signature Guards 2021-07-22 23:27:06 -07:00
Robert Widmann
d86551de67 Lift Requirement and Parameter Accessors up to GenericSignature
Start treating the null {Can}GenericSignature as a regular signature
with no requirements and no parameters. This not only makes for a much
safer abstraction, but allows us to simplify a lot of the clients of
GenericSignature that would previously have to check for null before
using the abstraction.
2021-07-22 23:27:05 -07:00
swift-ci
aa831950b4 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-19 07:36:06 -07:00
swift-ci
42d5ed877e Merge remote-tracking branch 'origin/main' into rebranch 2021-07-16 21:14:15 -07:00
Slava Pestov
02db632488 RequirementMachine: Re-use a single global RewriteContext 2021-07-17 00:05:05 -04:00
Slava Pestov
8c91ccaa8d AST: Asert that we don't create GenericSignatureBuilders when RequirementMachine is enabled 2021-07-17 00:05:05 -04:00
Slava Pestov
049b6e5a49 AST: Don't force RequirementMachine creation in getOrCreateGenericSignatureBuilder()
This was for test coverage before I had any queries ported over, just to
make sure that the completion procedure worked.

Now that all the GenericSignature queries have been ported over, we don't
need this since  we're going to create all the RequirementMachines anyway.
2021-07-17 00:05:05 -04:00
Slava Pestov
a65effed60 AST: Lazy construct GenericSignatureBuilder in a GenericEnvironment 2021-07-16 18:15:23 -04:00
Saleem Abdulrasool
d783b6add0 Revert "Begin untangling GenericEnvironment from GenericSignatureBuilder" 2021-07-15 16:05:05 -07:00
Slava Pestov
323e52e66a AST: Lazy construct GenericSignatureBuilder in a GenericEnvironment 2021-07-14 17:18:15 -04:00
swift-ci
a3ebc9a069 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-12 10:51:07 -07:00
Doug Gregor
29f5d7a64a [SE-0302] Implement '@unchecked Sendable' syntax.
Parse and provide semantic checking for '@unchecked Sendable', for a
Sendable conformance that doesn't perform additional semantic checks
for correctness.

Part of rdar://78269000.
2021-07-11 12:29:53 -07:00
swift-ci
8eed427d64 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-07 06:34:04 -07:00
QuietMisdreavus
0cc6ce962a Merge pull request #38070 from apple/QuietMisdreavus/spi-comments
include comments on SPI symbols when they're in symbol graphs
2021-07-07 07:30:04 -06:00
swift-ci
e0e2634b84 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-06 09:35:07 -07:00
Evan Wilde
2c04be2724 llvm::StringRef compare_lower -> compare_insensitive
The `compare_lower` API was replaced with `compare_insensitive` in llvm
commit 2e4a2b8430aca6f7aef8100a5ff81ca0328d03f9.

git clang-format ran.

(cherry picked from commit aca2de95ee)
2021-07-02 10:55:17 -07:00
Victoria Mitchell
85fabb23ed include comments on SPI symbols when they're in symbol graphs 2021-06-30 16:13:08 -06:00
Doug Gregor
9ec20776c9 [SE-0306] Make actors semantically "final".
Treat actors as being semantically `final` throughout the type checker.
This allows, for example, a non-`required` initializer to satisfy a
protocol requirement.

We're leaving the ABI open for actor inheritance should we need it.

Addresses rdar://78269551.
2021-06-30 10:59:49 -07:00