@@ -368,7 +368,10 @@ precedencegroup MultiplicationPrecedence {
368
368
precedencegroup BitwiseShiftPrecedence {
369
369
higherThan : MultiplicationPrecedence
370
370
}
371
-
371
+ precedencegroup ExponentiationPrecedence {
372
+ associativity : right
373
+ higherThan : MultiplicationPrecedence
374
+ }
372
375
373
376
//===----------------------------------------------------------------------===//
374
377
// Standard operators
@@ -398,6 +401,7 @@ prefix operator ..<: Comparable
398
401
399
402
// "Exponentiative"
400
403
404
+ infix operator ** : ExponentiationPrecedence
401
405
infix operator <<: BitwiseShiftPrecedence, BinaryInteger
402
406
infix operator &< < : BitwiseShiftPrecedence, FixedWidthInteger
403
407
infix operator >>: BitwiseShiftPrecedence, BinaryInteger
@@ -463,6 +467,7 @@ infix operator ||: LogicalDisjunctionPrecedence, Bool
463
467
464
468
// Compound
465
469
470
+ infix operator **= : AssignmentPrecedence
466
471
infix operator *= : AssignmentPrecedence, Numeric
467
472
infix operator &*= : AssignmentPrecedence, FixedWidthInteger
468
473
infix operator /= : AssignmentPrecedence, BinaryInteger
@@ -486,3 +491,48 @@ infix operator |=: AssignmentPrecedence, BinaryInteger
486
491
// example of how this operator is used, and how its use can be hidden
487
492
// from users.
488
493
infix operator ~>
494
+
495
+ //===----------------------------------------------------------------------===//
496
+ // Placeholder operator functions for diagnostic purposes
497
+ //===----------------------------------------------------------------------===//
498
+
499
+ extension Float {
500
+ @available ( * , unavailable, message: " use 'Foundation.pow' instead " )
501
+ @_alwaysEmitIntoClient
502
+ public static func ** ( lhs: Self , rhs: Self ) -> Self {
503
+ fatalError ( " Not implemented " )
504
+ }
505
+ @available ( * , unavailable, message: " use 'Foundation.pow' instead " )
506
+ @_alwaysEmitIntoClient
507
+ public static func **= ( lhs: inout Self , rhs: Self ) {
508
+ fatalError ( " Not implemented " )
509
+ }
510
+ }
511
+
512
+ extension Double {
513
+ @available ( * , unavailable, message: " use 'Foundation.pow' instead " )
514
+ @_alwaysEmitIntoClient
515
+ public static func ** ( lhs: Self , rhs: Self ) -> Self {
516
+ fatalError ( " Not implemented " )
517
+ }
518
+ @available ( * , unavailable, message: " use 'Foundation.pow' instead " )
519
+ @_alwaysEmitIntoClient
520
+ public static func **= ( lhs: inout Self , rhs: Self ) {
521
+ fatalError ( " Not implemented " )
522
+ }
523
+ }
524
+
525
+ #if !(os(Windows) || os(Android)) && (arch(i386) || arch(x86_64))
526
+ extension Float80 {
527
+ @available ( * , unavailable, message: " use 'Foundation.pow' instead " )
528
+ @_alwaysEmitIntoClient
529
+ public static func ** ( lhs: Self , rhs: Self ) -> Self {
530
+ fatalError ( " Not implemented " )
531
+ }
532
+ @available ( * , unavailable, message: " use 'Foundation.pow' instead " )
533
+ @_alwaysEmitIntoClient
534
+ public static func **= ( lhs: inout Self , rhs: Self ) {
535
+ fatalError ( " Not implemented " )
536
+ }
537
+ }
538
+ #endif
0 commit comments