File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
validation-test/compiler_crashers_2_fixed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -4184,7 +4184,16 @@ namespace {
4184
4184
auto keyPathTy = cs.getType (E)->castTo <BoundGenericType>();
4185
4185
Type baseTy = keyPathTy->getGenericArgs ()[0 ];
4186
4186
Type leafTy = keyPathTy->getGenericArgs ()[1 ];
4187
-
4187
+
4188
+ // We do not allow keypaths to go through AnyObject
4189
+ if (baseTy->isAnyObject ()) {
4190
+ auto rootTyRepr = E->getRootType ();
4191
+ cs.TC .diagnose (rootTyRepr->getLoc (),
4192
+ diag::expr_swift_keypath_invalid_component)
4193
+ .highlight (rootTyRepr->getSourceRange ());
4194
+ return nullptr ;
4195
+ }
4196
+
4188
4197
for (unsigned i : indices (E->getComponents ())) {
4189
4198
auto &origComponent = E->getMutableComponents ()[i];
4190
4199
Original file line number Diff line number Diff line change
1
+ // RUN: not %target-swift-frontend -emit-sil %s
2
+ // REQUIRES: OS=ios
3
+
4
+ import UIKit
5
+
6
+ // Just make sure we don't crash.
7
+
8
+ class Foo : NSObject {
9
+ func crash( ) {
10
+ let kp = \AnyObject . accessibilityFrame
11
+ }
12
+ }
You can’t perform that action at this time.
0 commit comments