Skip to content

[stdlib] Add ** and **= for exponentiation #36053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[stdlib] Remove ** and **= placeholders
  • Loading branch information
benrimmington committed Feb 19, 2021
commit 53fa48385bf220a2ead1282b8d3360a854fb639c
47 changes: 1 addition & 46 deletions stdlib/public/core/Policy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Copyright (c) 2014 - 2021 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
Expand Down Expand Up @@ -491,48 +491,3 @@ infix operator |=: AssignmentPrecedence, BinaryInteger
// example of how this operator is used, and how its use can be hidden
// from users.
infix operator ~>

//===----------------------------------------------------------------------===//
// Placeholder operator functions for diagnostic purposes
//===----------------------------------------------------------------------===//

extension Float {
@available(*, unavailable, message: "use 'Foundation.pow' instead")
@_alwaysEmitIntoClient
public static func ** (lhs: Self, rhs: Self) -> Self {
fatalError("Not implemented")
}
@available(*, unavailable, message: "use 'Foundation.pow' instead")
@_alwaysEmitIntoClient
public static func **= (lhs: inout Self, rhs: Self) {
fatalError("Not implemented")
}
}

extension Double {
@available(*, unavailable, message: "use 'Foundation.pow' instead")
@_alwaysEmitIntoClient
public static func ** (lhs: Self, rhs: Self) -> Self {
fatalError("Not implemented")
}
@available(*, unavailable, message: "use 'Foundation.pow' instead")
@_alwaysEmitIntoClient
public static func **= (lhs: inout Self, rhs: Self) {
fatalError("Not implemented")
}
}

#if !(os(Windows) || os(Android)) && (arch(i386) || arch(x86_64))
extension Float80 {
@available(*, unavailable, message: "use 'Foundation.pow' instead")
@_alwaysEmitIntoClient
public static func ** (lhs: Self, rhs: Self) -> Self {
fatalError("Not implemented")
}
@available(*, unavailable, message: "use 'Foundation.pow' instead")
@_alwaysEmitIntoClient
public static func **= (lhs: inout Self, rhs: Self) {
fatalError("Not implemented")
}
}
#endif