Skip to content

Commit 892c903

Browse files
committed
Fix embarrassing copy/paste error and enable Dave's test.
1 parent ecc6bd5 commit 892c903

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

stdlib/public/runtime/Casting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,7 @@ static bool _dynamicCastStructToStruct(OpaqueValue *destination,
22482248
}
22492249

22502250
// Sets.
2251-
} else if (descriptor == &_TMnVs10Dictionary) {
2251+
} else if (descriptor == &_TMnVs3Set) {
22522252
if (flags & DynamicCastFlags::Unconditional) {
22532253
_swift_setDownCastIndirect(source, destination,
22542254
sourceArgs[0], targetArgs[0]);

test/1_stdlib/CollectionCasts.swift.gyb

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// RUN: %line-directive %t/CollectionCasts.swift -- %target-build-swift -Xfrontend -enable-experimental-collection-casts %t/CollectionCasts.swift -o %t/a.out
1616
// RUN: %line-directive %t/CollectionCasts.swift -- %target-run %t/a.out 2>&1
1717
// REQUIRES: executable_test
18-
// XFAIL: *
1918

2019
import StdlibUnittest
2120

@@ -92,8 +91,6 @@ tests.test("${Collection}/Down/${method}/${Key1}=>${Key0}") {
9291

9392
% else:
9493

95-
// FIXME Set<Base> => Set<Derived> fails dynamically, and never even reaches
96-
// one of my runtime entry points.
9794
guard let downcasted = expectNotEmpty(cast(source, to: ${Collection}<${Key0}>.self))
9895
else { return }
9996

@@ -128,9 +125,6 @@ tests.test(
128125
% if method == 'Direct':
129126
let upcasted = source as [${Key1}:${Value1}]
130127
% else:
131-
// FIXME: Conditional casting fails to dynamically type-check, and never even
132-
// reaches one of my runtime entry points unless the source type is identical
133-
// to the destination type.
134128
let upcasted_ = source as Any as? [${Key1}:${Value1}]
135129

136130
guard let upcasted = expectNotEmpty(upcasted_) else { return }
@@ -163,21 +157,6 @@ tests.test(
163157
${DynamicKey}(42) as ${Key1} : ${DynamicValue}(42) as ${Value1},
164158
${DynamicKey}(17) as ${Key1} : ${DynamicValue}(17) as ${Value1}]
165159

166-
// FIXME: The following are routed through
167-
// _dictionaryBridgeFromObjectiveCConditional, causing the test to crash, but
168-
// there's no reason for bridging in these cases:
169-
//
170-
// [Derived:Any] => [Derived:AnyObject]
171-
// [Derived:Any] => [Derived:Base]
172-
// [Base:Any] => [Derived:Derived]
173-
// [Base:Any] => [Derived:Base]
174-
// [Base:Any] => [Derived:AnyObject]
175-
// [Base:Any] => [Base:Derived]
176-
// [Base:Any] => [Base:Base]
177-
// [Base:Any] => [Base:AnyObject]
178-
// [Int:AnyFoo] => [Int:Int]
179-
// [Int:Any] => [Int:Int]
180-
// [Int:Any] => [Int:AnyFoo]
181160
guard let downcasted = expectNotEmpty(source as? [${Key0}:${Value0}])
182161
else { return }
183162

0 commit comments

Comments
 (0)