[ConstraintSystem] Record generic fix if destination of a pointer conversion is invalid

If the right-hand side (destination) of value-to-pointer conversion
is incorrect e.g. base type of member is a hole, let's record
a generic "invalid conversion" failure.

Resolves: rdar://problem/68254165
This commit is contained in:
Pavel Yaskevich
2020-09-04 13:22:08 -07:00
parent 309cb93043
commit e4f6041dba
2 changed files with 11 additions and 2 deletions

View File

@@ -41,3 +41,9 @@ func SR12382(_ x: UnsafeMutablePointer<Double>??) {}
var i = 0
SR12382(&i) // expected-error {{cannot convert value of type 'UnsafeMutablePointer<Int>' to expected argument type 'UnsafeMutablePointer<Double>'}}
// expected-note@-1 {{arguments to generic parameter 'Pointee' ('Int' and 'Double') are expected to be equal}}
//problem/68254165 - Bad diagnostic when using String init(decodingCString:) with an incorrect pointer type
func rdar68254165(ptr: UnsafeMutablePointer<Int8>) {
_ = String(decodingCString: ptr, as: .utf8) // expected-error {{generic parameter 'Encoding' could not be inferred}}
// expected-error@-1 {{type '_.Type' has no member 'utf8'}}
}