Skip to content

Commit 7522ada

Browse files
authored
Merge pull request swiftlang#22512 from mattpolzin/sr9837
Add test that catches (currently fixed) regression - SR-9837
2 parents 82c33dc + a974aaa commit 7522ada

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

docs/Testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ We use multiple approaches to test the Swift toolchain.
2727

2828
### Testsuite subsets
2929

30-
The testsuite is split into four subsets:
30+
The testsuite is split into five subsets:
3131

3232
* Primary testsuite, located under ``swift/test``.
3333
* Validation testsuite, located under ``swift/validation-test``.
@@ -59,7 +59,7 @@ configured to use your local build directory. For example:
5959
% ${LLVM_SOURCE_ROOT}/utils/lit/lit.py -sv ${SWIFT_BUILD_DIR}/test-macosx-x86_64/Parse/
6060
```
6161

62-
This runs the tests in the 'test/Parse/' directory targeting 64-bit macOS.
62+
This runs the tests in the 'test/Parse/' directory targeting 64-bit macOS.
6363
The ``-sv`` options give you a nice progress bar and only show you
6464
output from the tests that fail.
6565

test/stdlib/Casts.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ CastsTests.test("No overrelease of existential boxes in failed casts") {
4343
}
4444
}
4545
}
46-
46+
4747
let err: Error = ErrClass()
4848
bar(err)
4949
}
@@ -70,6 +70,16 @@ CastsTests.test("Multi-level optionals can be casted") {
7070
testFailure(42, from: Int???.self, to: String.self)
7171
}
7272

73+
// Test for SR-9837: Optional<T>.none not casting to Optional<U>.none in generic context
74+
CastsTests.test("Optional<T>.none can be casted to Optional<U>.none in generic context") {
75+
func test<T>(_ type: T.Type) -> T? {
76+
return Any?.none as? T
77+
}
78+
79+
expectEqual(type(of: test(Bool.self)), Bool?.self)
80+
expectEqual(type(of: test(Bool?.self)), Bool??.self)
81+
}
82+
7383
#if _runtime(_ObjC)
7484
extension CFBitVector : P {
7585
static func makeImmutable(from values: Array<UInt8>) -> CFBitVector {

0 commit comments

Comments
 (0)