Files
swift-mirror/test/Constraints/valid_pointer_conversions.swift
Pavel Yaskevich 70ac657a46 [CSBindings] Don't delay bindings inferred through inout conversion
Delaying such bindings is too restrictive and leads to subpar selections.

For `$T1` to be array or C-style pointer it would have to be
connected either to a type variable that could be bound to
array/pointer or directly to array/pointer type which would
result in the solver either selecting the other type variable
first (because it appears in adjacent variables of `$T1`) or
provide an additional binding(s) for `$T1` (including literals).

Consider the following constraint system:

```
$T2 arg conv $T1
$T2 conforms ExpressibleByIntegerLiteral

inout $T1 arg conv UnsafeMutablePointer<UInt8>?
```

If `$T1` and `$T2` are the only viable type variables delaying
`$T1` would mean that `$T2` is picked to attempt its default
type `Int` which is incorrect (it doesn't get `UInt8` because
there is no transitive inference through conversions).
2024-10-31 11:58:55 -07:00

3.3 KiB