mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Detect and diagnose missing generic arguments
Introduce a fix to detect and diagnose situations when omitted
generic arguments couldn't be deduced by the solver based on
the enclosing context.
Example:
```swift
struct S<T> {
}
_ = S() // There is not enough context to deduce `T`
```
Resolves: rdar://problem/51203824
This commit is contained in:
@@ -49,32 +49,32 @@ func mismatchedAppends<T, U, V>(readOnlyLeft: KeyPath<T, U>,
|
||||
readOnlyRight: KeyPath<U, V>,
|
||||
writableRight: WritableKeyPath<U, V>,
|
||||
referenceRight: ReferenceWritableKeyPath<U, V>){
|
||||
// expected-error@+1{{}}
|
||||
_ = readOnlyRight.appending(path: readOnlyLeft)
|
||||
// expected-error@-1 {{referencing instance method 'appending(path:)' on '_AppendKeyPath' requires the types 'KeyPath<U, V>' and 'AnyKeyPath' be equivalent}}
|
||||
|
||||
// expected-error@+1{{}}
|
||||
_ = readOnlyRight.appending(path: writableLeft)
|
||||
// expected-error@-1 {{referencing instance method 'appending(path:)' on '_AppendKeyPath' requires the types 'KeyPath<U, V>' and 'AnyKeyPath' be equivalent}}
|
||||
|
||||
// expected-error@+1{{}}
|
||||
_ = readOnlyRight.appending(path: referenceLeft)
|
||||
// expected-error@-1 {{referencing instance method 'appending(path:)' on '_AppendKeyPath' requires the types 'KeyPath<U, V>' and 'AnyKeyPath' be equivalent}}
|
||||
|
||||
// expected-error@+1{{}}
|
||||
_ = writableRight.appending(path: readOnlyLeft)
|
||||
// expected-error@-1 {{referencing instance method 'appending(path:)' on '_AppendKeyPath' requires the types 'WritableKeyPath<U, V>' and 'AnyKeyPath' be equivalent}}
|
||||
|
||||
// expected-error@+1{{}}
|
||||
_ = writableRight.appending(path: writableLeft)
|
||||
// expected-error@-1 {{referencing instance method 'appending(path:)' on '_AppendKeyPath' requires the types 'WritableKeyPath<U, V>' and 'AnyKeyPath' be equivalent}}
|
||||
|
||||
// expected-error@+1{{}}
|
||||
_ = writableRight.appending(path: referenceLeft)
|
||||
// expected-error@-1 {{referencing instance method 'appending(path:)' on '_AppendKeyPath' requires the types 'WritableKeyPath<U, V>' and 'AnyKeyPath' be equivalent}}
|
||||
|
||||
// expected-error@+1{{}}
|
||||
_ = referenceRight.appending(path: readOnlyLeft)
|
||||
// expected-error@-1 {{referencing instance method 'appending(path:)' on '_AppendKeyPath' requires the types 'ReferenceWritableKeyPath<U, V>' and 'AnyKeyPath' be equivalent}}
|
||||
|
||||
// expected-error@+1{{}}
|
||||
_ = referenceRight.appending(path: writableLeft)
|
||||
// expected-error@-1 {{referencing instance method 'appending(path:)' on '_AppendKeyPath' requires the types 'ReferenceWritableKeyPath<U, V>' and 'AnyKeyPath' be equivalent}}
|
||||
|
||||
// expected-error@+1{{}}
|
||||
_ = referenceRight.appending(path: referenceLeft)
|
||||
// expected-error@-1 {{referencing instance method 'appending(path:)' on '_AppendKeyPath' requires the types 'ReferenceWritableKeyPath<U, V>' and 'AnyKeyPath' be equivalent}}
|
||||
}
|
||||
|
||||
func partialAppends<T, U, V>(partial: PartialKeyPath<T>,
|
||||
|
||||
Reference in New Issue
Block a user