mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[test] Adding regression tests for SR-15053
This commit is contained in:
@@ -68,3 +68,13 @@ class MoviesViewController {
|
||||
_ = itemType // expected-error {{ambiguous use of 'itemType'}}
|
||||
}
|
||||
}
|
||||
|
||||
// SR-15053
|
||||
func SR15053<T : Numeric>(_ a: T, _ b: T) -> T {
|
||||
(a + b) / 2 // expected-error{{cannot convert return expression of type 'Int' to return type 'T'}}
|
||||
// expected-error@-1{{cannot convert value of type 'T' to expected argument type 'Int'}}
|
||||
}
|
||||
|
||||
func SR15053<T : Numeric>(_ a: T, _ b: T) {
|
||||
(a + b) / 2 // expected-error{{cannot convert value of type 'T' to expected argument type 'Int'}}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ import Foundation
|
||||
struct S {
|
||||
init<T: NSNumber>(_ num: T) { // expected-note {{where 'T' = 'Bool'}}
|
||||
self.init(num != 0) // expected-error {{initializer 'init(_:)' requires that 'Bool' inherit from 'NSNumber'}}
|
||||
// expected-error@-1 {{referencing operator function '!=' on 'BinaryInteger' requires that 'T' conform to 'BinaryInteger'}}
|
||||
// expected-error@-1 {{cannot convert value of type 'T' to expected argument type 'Int'}}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user