File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
validation-test/Sema/type_checker_crashers_fixed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -3136,6 +3136,17 @@ static void eraseOpenedExistentials(Expr *&expr) {
3136
3136
" didn't see this OVE in a containing OpenExistentialExpr?" );
3137
3137
return { true , value->second };
3138
3138
}
3139
+
3140
+ // Handle collection upcasts specially so that we don't blow up on
3141
+ // their embedded OVEs.
3142
+ if (auto CDE = dyn_cast<CollectionUpcastConversionExpr>(expr)) {
3143
+ if (auto result = CDE->getSubExpr ()->walk (*this )) {
3144
+ CDE->setSubExpr (result);
3145
+ return { false , CDE };
3146
+ } else {
3147
+ return { true , CDE };
3148
+ }
3149
+ }
3139
3150
3140
3151
return { true , expr };
3141
3152
}
Original file line number Diff line number Diff line change
1
+ // RUN: not %target-swift-frontend %s -parse
2
+
3
+ class C { }
4
+ class D : C { }
5
+
6
+ @_silgen_name ( " consume " )
7
+ func consume( _: [ C ] ) // note, returns ()
8
+
9
+ // Assert/crash while emitting diagnostic for coercion from () to Bool
10
+ // in the context of a collection cast.
11
+ func test( x: [ D ] ) -> Bool {
12
+ return consume ( x) // no way to coerce from () to Bool
13
+ }
You can’t perform that action at this time.
0 commit comments