File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
validation-test/compiler_crashers_fixed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2060,10 +2060,20 @@ namespace {
20602060 return valueTy;
20612061 }
20622062
2063- Type visitAnyTryExpr (AnyTryExpr *expr) {
2063+ Type visitTryExpr (AnyTryExpr *expr) {
20642064 return CS.getType (expr->getSubExpr ());
20652065 }
20662066
2067+ Type visitForceTryExpr (AnyTryExpr *expr) {
2068+ auto valueTy = CS.createTypeVariable (CS.getConstraintLocator (expr),
2069+ TVO_PrefersSubtypeBinding |
2070+ TVO_CanBindToNoEscape);
2071+ CS.addConstraint (ConstraintKind::Equal, valueTy,
2072+ CS.getType (expr->getSubExpr ()),
2073+ CS.getConstraintLocator (expr));
2074+ return valueTy;
2075+ }
2076+
20672077 Type visitOptionalTryExpr (OptionalTryExpr *expr) {
20682078 auto valueTy = CS.createTypeVariable (CS.getConstraintLocator (expr),
20692079 TVO_PrefersSubtypeBinding |
Original file line number Diff line number Diff line change 11// RUN: %target-typecheck-verify-swift
2+ // RUN: %target-swift-emit-silgen %s
23
34class C {
45 var x = 0
@@ -7,4 +8,5 @@ class C {
78do {
89 let x = C ( )
910 let _ = ( 0 , try x. x) // expected-warning {{no calls to throwing functions occur within 'try' expression}}
11+ let _ = ( 0 , try ! x. x) // expected-warning {{no calls to throwing functions occur within 'try' expression}}
1012}
You can’t perform that action at this time.
0 commit comments