Skip to content

Commit a381b1d

Browse files
authored
Merge pull request #85968 from slavapestov/tests-12-10-2025
Add some regression tests
2 parents dea291c + a092739 commit a381b1d

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %target-typecheck-verify-swift -solver-scope-threshold=110000
2+
3+
func slow() {
4+
print(Array(1...5).filter({ $0 < 3 }).map({ $0 * 10 }).reduce(0, +))
5+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %target-typecheck-verify-swift -solver-scope-threshold=100
2+
3+
class Something {
4+
var placeName: String? = "Home"
5+
var streetAddress: String? = "123 Home Street"
6+
var cityTown: String? = "New Hometown"
7+
var state: String? = "HO"
8+
var zipCode: String? = "12345"
9+
var coordinate = (latitude: 40.5, longitude: 40.5)
10+
11+
var description: String {
12+
return "-----------------------------\n" +
13+
"Place Name: \(placeName ?? "")\n" +
14+
"Street Address: \(streetAddress ?? "")\n" +
15+
"City: \(cityTown ?? "")\n" +
16+
"State: \(state ?? "")\n" +
17+
"Zip Code: \(zipCode ?? "")\n" +
18+
"Coordinate: latitude: \(coordinate.latitude) longitude \(coordinate.longitude)\n" +
19+
"-----------------------------\n"
20+
}
21+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %target-swift-frontend -emit-ir %s
2+
3+
struct P<A, B> { let l: A; let r: B }
4+
struct Value { let v: Double? }
5+
6+
func +<A, B, C>(l: P<A, C>, r: P<B, C>) -> P<(A, B), C> {
7+
return P(l: (l.l, r.l), r: l.r)
8+
}
9+
10+
infix operator <!>
11+
12+
func <!> <A>(l: A?, r: A) -> A {
13+
return l == nil ? r : l!
14+
}
15+
16+
func <!> <A, B, C>(l: P<A, B>, r: () -> C) -> P<A, C> {
17+
return P(l: l.l, r: r())
18+
}
19+
20+
let xs: [Value] = []
21+
let a: String = String(xs.reduce(0.0, { (acc, i) in
22+
acc + (i.v <!> 0)
23+
}))
24+
25+
print(a)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: not %target-swift-frontend -typecheck %s
2+
3+
struct X: ExpressibleByStringLiteral {
4+
let i: Int
5+
}
6+
7+
enum E: X {
8+
case fooBar = "A"
9+
}
10+
11+
print(E.fooBar)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %target-swift-frontend -emit-ir %s
2+
3+
func test(_ data: UnsafePointer<Int8>?, len: Int) {
4+
data?.withMemoryRebound(to: UInt8.self, capacity: len) {
5+
data in
6+
for i in 0..<len {
7+
print("\(data[i])")
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)