File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -454,3 +454,23 @@ func test_inference_through_implicit_conversion() {
454454 let _: UnsafePointer < C > = test ( [ C ( ) ] ) // Ok - argument is implicitly converted to a pointer
455455 let _: AnyHashable = test ( C ( ) ) // Ok - argument is implicitly converted to `AnyHashable` because it's Hashable
456456}
457+
458+ // Make sure that conformances transitively checked through implicit conversions work with conditional requirements
459+ protocol TestCond { }
460+
461+ extension Optional : TestCond where Wrapped == Int ? { }
462+
463+ func simple< T : TestCond > ( _ x: T ) -> T { x }
464+
465+ func overloaded< T: TestCond > ( _ x: T ) -> T { x }
466+ func overloaded< T: TestCond > ( _ x: String ) -> T { fatalError ( ) }
467+
468+ func overloaded_result( ) -> Int { 42 }
469+ func overloaded_result( ) -> String { " " }
470+
471+ func test_arg_conformance_with_conditional_reqs( i: Int ) {
472+ let _: Int ? ? = simple ( i)
473+ let _: Int ? ? = overloaded ( i)
474+ let _: Int ? ? = simple ( overloaded_result ( ) )
475+ let _: Int ? ? = overloaded ( overloaded_result ( ) )
476+ }
You can’t perform that action at this time.
0 commit comments