mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This makes diagnostics more verbose and accurate, because it's possible to distinguish how many parameters there are based on the message itself. Also there are multiple diagnostic messages in a format of `<descriptive-kind> <decl-name> ...` that get printed as e.g. `subscript 'subscript'` if empty labels are omitted.
19 lines
496 B
Swift
19 lines
496 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 { // expected-note {{where 'T' = 'Double'}}
|
|
fatalError()
|
|
}
|
|
}
|
|
|
|
func foo(_ v: Double) {
|
|
_ = A()[S(value: v)]
|
|
// expected-error@-1 {{subscript 'subscript(_:)' requires that 'Double' conform to 'P'}}
|
|
// expected-error@-2 {{referencing initializer 'init(value:)' on 'S' requires that 'Double' conform to 'P'}}
|
|
}
|