Pavel Yaskevich
55bae6150d
[Constraint] Allow closure body elements to carry contextual information
2021-10-08 10:08:02 -07:00
Pavel Yaskevich
9073d00613
[ConstraintSystem] Allow conjunctions marking conjunctions as isolated from the rest of the system
2021-10-08 10:08:01 -07:00
Pavel Yaskevich
ad01027a0d
[ConstraintSystem] Allow closure body element constraint to reference type variables
...
This would be useful when once it's used as part of a conjunction to
be able to solve the closure body element component in isolation.
2021-10-08 10:08:01 -07:00
Pavel Yaskevich
73dffb3125
[ConstraintSystem] Don't require a type variable per closure body element
...
Since each of the body elements is already going to have a type associated
with it there is no need to create yet another type variable.
2021-10-08 10:08:01 -07:00
Pavel Yaskevich
6aaee599bd
[ConstraintSystem] Allow conjunction constraints to reference other variables
2021-10-08 10:08:00 -07:00
Pavel Yaskevich
2b4691048e
[ConstraintSystem] Add a skeleton of Conjunction constraint
...
It's similar to disjunction constraint but represents an "and"
relationship between its elements instead of "or", so all of the
elements have to produce a solution for conjunction constraint
to be considered solved successfully.
2021-10-08 10:08:00 -07:00
Pavel Yaskevich
eb8eabfba7
[ConstraintSystem] Add a skeleton of ClosureBodyElement constraint
2021-10-08 10:08:00 -07:00
Pavel Yaskevich
9e7a670295
[ConstraintSystem] Implement new Swift -> C pointer conversions
...
Allow following conversions in argument positions
(applies only to call to imported C/ObjC declarations):
- Unsafe[Mutable]RawPointer -> Unsafe[Mutable]Pointer<[U]Int>
- Unsafe[Mutable]Pointer<Int{8, 16, ...}> <-> Unsafe[Mutable]Pointer<UInt{8, 16, ...}>
2021-09-20 17:22:25 -07:00
Pavel Yaskevich
3a41f7af5f
[ConstraintSystem] Add a new conversion - Swift to C pointers
...
Following pointer conversions are supported in argument positions (when referencing C/ObjC functions):
- Unsafe[Mutable]RawPointer -> Unsafe[Mutable]Pointer<[U]Int>
- Unsafe[Mutable]Pointer<Int{8, 16, ...}> -> Unsafe[Mutable]Pointer<UInt{8, 16, ...}>
2021-09-20 17:22:25 -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
Pavel Yaskevich
957e05cfb1
[Constraint] Allow constraints to be disabled only in "performance" mode
2021-04-27 16:11:47 -07:00
Pavel Yaskevich
985843a21f
[ConstraintSystem] Add a new transitive conformance constraint
...
Conformance constraints could be transferred through conversions,
but that would also require checking implicit conversions
such as optional and pointer promotions for conformance is the
type itself doesn't conform, for that let's add a special constraint
`TransitivelyConformsTo`.
2021-04-07 17:55:11 -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
Holly Borla
7cd8add885
[ConstraintSystem] Add a property wrapper constraint to delay checking
...
if an inferred wrapper type is a property wrapper until that type is
resolved.
2021-03-24 11:24:21 -07:00
Pavel Yaskevich
a559ca8c53
[TypeChecker/SE-0307] NFC: Fix typos and clarify a couple of comments
...
Thanks Xiaodi Wu!
2021-03-17 14:11:53 -07:00
Pavel Yaskevich
8c6017687a
[ConstraintSystem] Limit new implicit conversion to only Double <-> CGFloat
2021-03-17 00:18:10 -07:00
Pavel Yaskevich
2b935bab7c
[ConstraintSystem] Add conversion restriction to cover implicit conversion from/to CGFloat
2021-03-17 00:18:08 -07:00
Pavel Yaskevich
497d42d90e
[ConstraintSystem] Add a new constraint which connects base with result of the member chain
...
The first type represents a result of an unresolved member chain,
and the second type is its base type. This constraint acts almost
like `Equal` but also enforces following semantics:
- It's possible to infer a base from a result type by looking through
this constraint, but it's only solved when both types are bound.
- If base is a protocol metatype, this constraint becomes a conformance
check instead of an equality.
2021-02-23 11:33:10 -08:00
Holly Borla
752cf7f2ac
[ConstraintSystem] Consider the number of resolved argument types
...
for applied overloads when selecting a disjunction to attempt.
2021-02-03 13:26:57 -08:00
Pavel Yaskevich
b03dc63634
[AST] Adjust TypeBase::getTypeVariables to accept a set
...
Currently the pattern is to collect the type variables and then unique
them. Instead of asking clients to do uniquing, let's just accept a set
as an argument.
2021-01-26 18:13:34 -08:00
Holly Borla
12dce859a2
[NFC][ConstraintSystem] Use llvm::count_if for the count methods on
...
Constraint.
2020-11-05 09:56:00 -08:00
gregomni
2edba9dfbd
Instead of chaining binops, favor disjunctions with op overloads whose types match existing binding choices
2020-10-15 09:03:45 -07:00
Pavel Yaskevich
6ba7ecb7c2
[ConstraintSystem] NFC: Move Constraint.h to include/swift/Sema
2020-10-08 10:45:32 -07:00