Files
swift-mirror/test/Constraints/rdar44569159.swift
Pavel Yaskevich cbadd7ffc2 [Diagnostics] Correctly identify location of requirement failure
Previously in situations like:

```swift
protocol P {}

struct S<T: P> {
  var value: T
}

_ = S(value: 42)
```

Diagnostic has reported a problem as related to "reference" to `init`
but the failing generic type requirement belongs to `S`, so a
better diagnostic in such case should mention `generic struct S`.
2019-08-16 22:02:37 -07:00

18 lines
339 B
Swift

// RUN: %target-typecheck-verify-swift
protocol P {}
struct S<V> where V: P { // expected-note {{where 'V' = 'Double'}}
var value: V
}
struct A {
subscript<T>(_ v: S<T>) -> A {
fatalError()
}
}
func foo(_ v: Double) {
_ = A()[S(value: v)]
// expected-error@-1 {{generic struct 'S' requires that 'Double' conform to 'P'}}
}