Skip to content

Commit 6871974

Browse files
committed
[test] Add indexing test for overloaded @dynamicMemberLookup
Source compat suite uncovered a crash here with my IUO refactoring, make sure we cover this case in the test suite.
1 parent 8e5ccec commit 6871974

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/Index/index_keypath_member_lookup.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,11 @@ extension Foo {
158158
// CHECK: [[@LINE-1]]:5 | instance-property/Swift | prop | [[PROP_USR]] | Ref,Read,RelCont | rel: 1
159159
}
160160
}
161+
162+
// Also make sure we don't crash for multiple overloads.
163+
@dynamicMemberLookup
164+
protocol P {}
165+
extension P {
166+
subscript<T>(dynamicMember keyPath: KeyPath<Bar, T>) -> Int { 0 }
167+
subscript<T>(dynamicMember keyPath: KeyPath<P, T>) -> Int { 0 }
168+
}

0 commit comments

Comments
 (0)