Skip to content

Commit 49ef402

Browse files
[tests] Adding few more test cases for redundant coercion warning
1 parent 4fc26b7 commit 49ef402

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/expr/cast/as_coerce.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,15 @@ func f11295_overload() -> Double { 0.0 }
226226
_ = f11295_overload() as Int // OK
227227
_ = f11295_overload() as Double // OK
228228

229+
// Param overload with generics
230+
func f11295_param_overload(_ a: Int) {}
231+
func f11295_param_overload(_ a: Double) {}
232+
233+
func fNum<N: Numeric>() -> N { 0 }
234+
235+
f11295_param_overload(fNum() as Int) // Ok
236+
f11295_param_overload(fNum() as Double) // Ok
237+
229238
// Coerce tuple elements
230239
func f11295_Tuple(_ a: (Int, Int)){}
231240
func f11295_TupleGeneric<T>(_ a: (T, T)){}

0 commit comments

Comments
 (0)