Skip to content

Commit e69f7eb

Browse files
authored
Merge pull request #39343 from hamishknight/assorted-tests
2 parents 8e5ccec + 4a1a2cd commit e69f7eb

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

test/Constraints/array_literal.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,3 +355,10 @@ func testSR8385() {
355355
let _: [SR8385] = ["hello", SR8385.text("world")]
356356
let _: [SR8385] = ["hello", .text("world")]
357357
}
358+
359+
struct TestMultipleOverloadedInits {
360+
var x: Double
361+
func foo() {
362+
let _ = [Float(x), Float(x), Float(x), Float(x)]
363+
}
364+
}

test/Constraints/iuo.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,12 @@ let _: Int = r
229229
// SR-11998 / rdar://problem/58455441
230230
class C<T> {}
231231
var sub: C! = C<Int>()
232+
233+
// FIXME: We probably shouldn't support this, we don't support other
234+
// 'direct call' features such as default arguments for curried calls.
235+
struct CurriedIUO {
236+
func silly() -> Int! { nil }
237+
func testSilly() {
238+
let _: Int = CurriedIUO.silly(self)()
239+
}
240+
}

test/Constraints/tuple_arguments.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,3 +1768,12 @@ func noescapeSplat() {
17681768
}
17691769
}
17701770

1771+
func variadicSplat() {
1772+
func takesFnWithVarg(fn: (Int, Int...) -> Void) {}
1773+
takesFnWithVarg { x in // expected-error {{contextual closure type '(Int, Int...) -> Void' expects 2 arguments, but 1 was used in closure body}}
1774+
_ = x.1.count
1775+
}
1776+
takesFnWithVarg { x, y in
1777+
_ = y.count
1778+
}
1779+
}

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)