We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 26a4d5c + ae8efa3 commit ce135e6Copy full SHA for ce135e6
test/Constraints/protocols.swift
@@ -432,3 +432,20 @@ func rdar70814576() {
432
433
test(S()) // expected-error {{argument type 'S' does not conform to expected type 'Fooable'}}
434
}
435
+
436
+extension Optional : Trivial {
437
+ typealias T = Wrapped
438
+}
439
440
+extension UnsafePointer : Trivial {
441
+ typealias T = Int
442
443
444
+func test_inference_through_implicit_conversion() {
445
+ class C {}
446
447
+ func test<T: Trivial>(_: T) -> T {}
448
449
+ let _: C? = test(C()) // Ok -> argument is implicitly promoted into an optional
450
+ let _: UnsafePointer<C> = test([C()]) // Ok - argument is implicitly converted to a pointer
451
0 commit comments