Files
swift-mirror/test/Constraints/rdar44569159.swift
Pavel Yaskevich 63b802ca88 [AST/Printing] Don't omit empty labels in special names
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.
2018-09-24 18:36:53 -07:00

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'}}
}