Skip to content

Commit 1e9f882

Browse files
committed
Sema: Split off Apple-specific parts of bidirectional_conversions.swift test
1 parent 3e2943f commit 1e9f882

File tree

2 files changed

+81
-67
lines changed

2 files changed

+81
-67
lines changed
Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
// RUN: %target-typecheck-verify-swift
2-
// REQUIRES: objc_interop
3-
4-
import Foundation
5-
import CoreGraphics
62

73
/////////////
84

@@ -20,26 +16,6 @@ func foo2(x: (Int, Int)?, y: (x: Int, y: Int)) -> G<(Int, Int)> {
2016
return g
2117
}
2218

23-
func foo3(x: (@convention(block) () -> ())?, y: @escaping () -> ()) -> G<@convention(block) () -> ()> {
24-
let g = G(t: x ?? y)
25-
return g
26-
}
27-
28-
func foo4(x: (() -> ())?, y: @escaping @convention(block) () -> ()) -> G<() -> ()> {
29-
let g = G(t: x ?? y)
30-
return g
31-
}
32-
33-
func foo5(x: CGFloat?, y: Double) -> G<CGFloat> {
34-
let g = G(t: x ?? y)
35-
return g
36-
}
37-
38-
func foo6(x: Double?, y: CGFloat) -> G<Double> {
39-
let g = G(t: x ?? y)
40-
return g
41-
}
42-
4319
/////////////
4420

4521
func id<T>(_: T) -> T {}
@@ -54,28 +30,6 @@ func bar2(x: (Int, Int)) {
5430
f(id(x))
5531
}
5632

57-
func bar3(x: @escaping () -> ()) {
58-
func f(_: @escaping @convention(block) () -> ()) {}
59-
// FIXME
60-
f(id(x)) // expected-error {{conflicting arguments to generic parameter 'T' ('@convention(block) () -> ()' vs. '() -> ()')}}
61-
}
62-
63-
func bar4(x: @escaping @convention(block) () -> ()) {
64-
func f(_: @escaping () -> ()) {}
65-
// FIXME
66-
f(id(x)) // expected-error {{conflicting arguments to generic parameter 'T' ('() -> ()' vs. '@convention(block) () -> ()')}}
67-
}
68-
69-
func bar5(x: Double) {
70-
func f(_: CGFloat) {}
71-
f(id(x))
72-
}
73-
74-
func bar6(x: CGFloat) {
75-
func f(_: Double) {}
76-
f(id(x))
77-
}
78-
7933
/////////////
8034

8135
func unwrap<T>(_: T?) -> T {}
@@ -89,24 +43,3 @@ func baz2(x: (Int, Int)?) {
8943
func f(_: (x: Int, y: Int)) {}
9044
f(unwrap(x))
9145
}
92-
93-
func baz3(x: (() -> ())?) {
94-
func f(_: @escaping @convention(block) () -> ()) {}
95-
f(unwrap(x))
96-
}
97-
98-
func baz4(x: (@convention(block) () -> ())?) {
99-
func f(_: @escaping () -> ()) {}
100-
f(unwrap(x))
101-
}
102-
103-
func baz5(x: Double?) {
104-
func f(_: CGFloat) {}
105-
f(unwrap(x))
106-
}
107-
108-
func baz6(x: CGFloat?) {
109-
func f(_: Double) {}
110-
f(unwrap(x))
111-
}
112-
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// RUN: %target-typecheck-verify-swift
2+
// REQUIRES: objc_interop
3+
4+
import Foundation
5+
import CoreGraphics
6+
7+
/////////////
8+
9+
struct G<T> {
10+
var t: T
11+
}
12+
13+
func foo3(x: (@convention(block) () -> ())?, y: @escaping () -> ()) -> G<@convention(block) () -> ()> {
14+
let g = G(t: x ?? y)
15+
return g
16+
}
17+
18+
func foo4(x: (() -> ())?, y: @escaping @convention(block) () -> ()) -> G<() -> ()> {
19+
let g = G(t: x ?? y)
20+
return g
21+
}
22+
23+
func foo5(x: CGFloat?, y: Double) -> G<CGFloat> {
24+
let g = G(t: x ?? y)
25+
return g
26+
}
27+
28+
func foo6(x: Double?, y: CGFloat) -> G<Double> {
29+
let g = G(t: x ?? y)
30+
return g
31+
}
32+
33+
/////////////
34+
35+
func id<T>(_: T) -> T {}
36+
37+
func bar3(x: @escaping () -> ()) {
38+
func f(_: @escaping @convention(block) () -> ()) {}
39+
// FIXME
40+
f(id(x)) // expected-error {{conflicting arguments to generic parameter 'T' ('@convention(block) () -> ()' vs. '() -> ()')}}
41+
}
42+
43+
func bar4(x: @escaping @convention(block) () -> ()) {
44+
func f(_: @escaping () -> ()) {}
45+
// FIXME
46+
f(id(x)) // expected-error {{conflicting arguments to generic parameter 'T' ('() -> ()' vs. '@convention(block) () -> ()')}}
47+
}
48+
49+
func bar5(x: Double) {
50+
func f(_: CGFloat) {}
51+
f(id(x))
52+
}
53+
54+
func bar6(x: CGFloat) {
55+
func f(_: Double) {}
56+
f(id(x))
57+
}
58+
59+
/////////////
60+
61+
func unwrap<T>(_: T?) -> T {}
62+
63+
func baz3(x: (() -> ())?) {
64+
func f(_: @escaping @convention(block) () -> ()) {}
65+
f(unwrap(x))
66+
}
67+
68+
func baz4(x: (@convention(block) () -> ())?) {
69+
func f(_: @escaping () -> ()) {}
70+
f(unwrap(x))
71+
}
72+
73+
func baz5(x: Double?) {
74+
func f(_: CGFloat) {}
75+
f(unwrap(x))
76+
}
77+
78+
func baz6(x: CGFloat?) {
79+
func f(_: Double) {}
80+
f(unwrap(x))
81+
}

0 commit comments

Comments
 (0)