mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
19 lines
532 B
Swift
19 lines
532 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
infix operator **
|
|
|
|
func **(a: Double, b: Double) -> Double { return 0 }
|
|
|
|
func testDeclaredPowerOperator() {
|
|
let x: Double = 3.0
|
|
let y: Double = 3.0
|
|
_ = 2.0**2.0 // no error
|
|
_ = x**y // no error
|
|
}
|
|
|
|
func testDeclaredPowerOperatorWithIncompatibleType() {
|
|
let x: Int8 = 3
|
|
let y: Int8 = 3
|
|
_ = x**y // expected-error{{cannot convert value of type 'Int8' to expected argument type 'Double'}} expected-error{{cannot convert value of type 'Int8' to expected argument type 'Double'}}
|
|
}
|