File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -3491,7 +3491,8 @@ bool FailureDiagnosis::diagnoseContextualConversionError() {
3491
3491
return true ;
3492
3492
}
3493
3493
}
3494
- } else if (contextDecl == CS->TC .Context .getUnsafePointerDecl ()) {
3494
+ } else if (contextDecl == CS->TC .Context .getUnsafePointerDecl () ||
3495
+ contextDecl == CS->TC .Context .getUnsafeMutablePointerDecl ()) {
3495
3496
SmallVector<Type, 4 > scratch;
3496
3497
for (Type arg : contextualType->getAllGenericArgs (scratch)) {
3497
3498
if (arg->isEqual (exprType)) {
Original file line number Diff line number Diff line change 2
2
3
3
func foo1( _ a: [ Int ] ) { }
4
4
func foo2( _ a : UnsafePointer < Int > ) { }
5
+ func foo4( _ a : UnsafeMutablePointer < Int > ) { }
5
6
func foo3 ( ) {
6
7
foo1 ( 1 ) // expected-error {{cannot convert value of type 'Int' to expected argument type '[Int]'}} {{8-8=[}} {{9-9=]}}
7
8
foo2 ( 1 ) // expected-error {{cannot convert value of type 'Int' to expected argument type 'UnsafePointer<Int>'}} {{8-8=&}}
8
9
var j = 3
9
10
foo2 ( j) // expected-error {{cannot convert value of type 'Int' to expected argument type 'UnsafePointer<Int>'}} {{8-8=&}}
11
+ foo4 ( j) // expected-error {{cannot convert value of type 'Int' to expected argument type 'UnsafeMutablePointer<Int>'}} {{8-8=&}}
10
12
}
You can’t perform that action at this time.
0 commit comments