Commit Graph

29 Commits

Author SHA1 Message Date
Robert Widmann
b3f70c960e Implement Pack Locators 2021-12-16 01:16:45 -08:00
Hamish Knight
aba30e7f72 Merge pull request #39543 from hamishknight/constructing-a-tier-list 2021-10-12 14:05:25 +01:00
Hamish Knight
a1abcee108 [CS] Introduce ConstructorMemberType locator elt
Use this new element to represent the overload type
for a constructor call, and have it store a bit
indicating whether the call is for a short-form
`X(...)` or self-delegating `self.init(...)` call.
2021-10-12 09:51:44 +01:00
LucianoAlmeida
6e072ba816 [Sema] Increase impact of conformance failure in generic arguments for operators 2021-10-11 21:47:44 -03:00
Pavel Yaskevich
0247652239 [ConstraintSystem/Closures] Add support for case statement 2021-10-08 10:08:02 -07:00
Pavel Yaskevich
99a9828a03 [ConstraintSystem] Add a new contextual purpose - CTP_CaseStmt 2021-10-08 10:08:02 -07:00
Pavel Yaskevich
7197fac8f5 [ConstraintSystem] Add a new contextual purpose - CTP_ForEachSequence
A contextual purpose for a sequence expression associated with
`for-in` statement, that decays into a `ConformsTo` constraint
to a `Sequence` or `AsyncSequence` protocol.

Note that CTP_ForEachSequence is almost identical to CTP_ForEachStmt
but the meaning of latter is overloaded, so to avoid breaking solution
targets I have decided to add a new purpose for now.
2021-10-08 10:08:02 -07:00
Pavel Yaskevich
84ca85dc01 [ConstraintLocator] Add a new element to track closure body elements 2021-10-08 10:08:01 -07: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
Holly Borla
939a861fe1 [ConstraintSystem] Add a constraint locator path element for tuple types,
which will provide context for tuple element mismatch diagnostics.
2021-06-23 19:18:11 -07:00
Pavel Yaskevich
b7a7024e0a [ConstraintLocator] Add information about expected value type to key path locator
Record a "value" type associated with this location to be able to
reference during inference.
2021-05-28 17:51:58 -07:00
Pavel Yaskevich
51ff12d06e [ConstraintLocator] Augment ContextualType element to carry its purpose
Having purpose attached to the contextual type element makes it much
easier to diagnose contextual mismatches without involving constraint
system state.
2021-04-26 09:51:21 -07:00
Strieker
4e2b67cbae [NFC] Resolved merge conflict in CSSimplify.cpp after making changes to improve error handling for composed wrapped value mismatches 2021-04-22 11:49:21 -07:00
Strieker
3891dc7fdc [ConstraintSystem] Added necessary logic so that a constraint locator can recognize a composed property wrapper’s wrapped value type. 2021-04-22 11:31:41 -07:00
Pavel Yaskevich
f00c578761 Merge pull request #34401 from xedin/implicit-cgfloat-conversion
[DNM][TypeChecker] Implement Double <-> CGFloat implicit conversion
2021-03-31 10:20:28 -07:00
Doug Gregor
d6fc1fd60f Implement conversions for global-actor-qualified functions.
One can convert from a function value without a global actor to a
similar function type that does have a global actor, but one cannot
remove or change a global actor on a function type.
2021-03-17 00:51:26 -07:00
Pavel Yaskevich
7aed970cdf [ConstraintLocator] Add is convenience method to simplify check for kind of implicit conversion 2021-03-17 00:18:10 -07:00
Pavel Yaskevich
389fd29e6c [ConstraintSystem] Add a path element to represent an implicit conversion 2021-03-17 00:18:06 -07:00
Pavel Yaskevich
fb89d11931 [ConstraintLocator] NFC: Adjust name of isForKeyPathComponent to clarify its meaning
New name is `isInKeyPathComponent` since it's implemeneted as a
check for presence of `KeyPathComponent` element in the locator
that covers every sub-element contained in a key path component
as well.
2021-03-12 09:58:54 -08:00
Pavel Yaskevich
a8ad32d55b [ConstraintLocator] Add a new locator accessor to check whether it belongs to key path component result 2021-03-12 09:27:18 -08:00
Nathan Hawes
44e09bc246 Merge branch 'main' into dont-allow-missing-args-if-trailing-and-not-function-type 2021-02-23 12:53:50 +10:00
Nathan Hawes
cdcaa110e8 [CodeCompletion][Sema] Refine logic that ignores missing arguments after the code completion position when solving
If the completion loc was in a trailing closure arg, it only makes sense to
ignore later missing args if they have function type, as there's no way for the
user to complete the call for overload being matched otherwise.

Also fix a bug where we were incorrectly penalizing solutions with holes that
were ultimately due to missing arguments after the completion position.

Resolves rdar://problem/72412302
2021-02-20 08:59:47 +10:00
Frederick Kellison-Linn
e4ea1678dc Rename HoleType to PlaceholderType
HoleType basically served the same purpose as PlaceholderType. This commit unifies the two.
2021-02-16 22:59:19 -05:00
Doug Gregor
ba8819eb58 [Concurrent] Introduce concurrent function types.
Introduce `@concurrent` attribute on function types, including:
* Parsing as a type attribute
* (De-/re-/)mangling for concurrent function types
* Implicit conversion from @concurrent to non-@concurrent
- (De-)serialization for concurrent function types
- AST printing and dumping support
2021-01-27 14:22:32 -08:00
Pavel Yaskevich
114364873d [ConstraintSystem] Adjust ConformanceRequirement locator to carry ProtocolConformance 2021-01-08 11:34:26 -08:00
Pavel Yaskevich
dbfeb5eea1 [ConstraintLocator] Add a new locator path element - ConformanceRequirement
Records protocol requirement associated with a particular type in
the constraint system, also useful to track parent conformance
for conditional requirements.
2021-01-06 10:13:55 -08:00
Doug Gregor
6d41524fe6 [SE-0289] Finish renaming source code, tests to "result builders" 2020-10-20 22:18:51 -07:00
Doug Gregor
0d568a93d4 [SE-0289] Update diagnostics & many other strings to "result builders" 2020-10-20 21:44:09 -07:00
Pavel Yaskevich
f2614dec4a [ConstraintSystem] NFC: Move ConstraintLocator.h to include/swift/Sema 2020-10-08 10:42:39 -07:00