Skip to content

Commit

Permalink
[stdlib] removed &&/|| overloads
Browse files Browse the repository at this point in the history
rdar://problem/19340207

Swift SVN r25252
  • Loading branch information
mxswd committed Feb 12, 2015
1 parent ac93e35 commit 654dab2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 37 deletions.
21 changes: 2 additions & 19 deletions stdlib/core/BooleanType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public prefix func !<T : BooleanType>(a: T) -> Bool {

/// If `lhs` is `false`, return it. Otherwise, evaluate `rhs` and
/// return its `boolValue`.
@inline(__always)
@transparent
public func && <T: BooleanType, U: BooleanType>(
lhs: T, @autoclosure rhs: () -> U
) -> Bool {
Expand All @@ -28,26 +28,9 @@ public func && <T: BooleanType, U: BooleanType>(

/// If `lhs` is `true`, return it. Otherwise, evaluate `rhs` and
/// return its `boolValue`.
@inline(__always)
@transparent
public func || <T: BooleanType, U: BooleanType>(
lhs: T, @autoclosure rhs: () -> U
) -> Bool {
return lhs.boolValue ? true : rhs().boolValue
}

// FIXME: We can't make the above @transparent due to
// rdar://problem/17872402, so here are some @transparent overloads
// for Bool. We've done the same for ObjCBool
@transparent
public func && <T: BooleanType>(
lhs: T, @autoclosure rhs: () -> Bool
) -> Bool {
return lhs.boolValue ? rhs().boolValue : false
}

@transparent
public func || <T: BooleanType>(
lhs: T, @autoclosure rhs: () -> Bool
) -> Bool {
return lhs.boolValue ? true : rhs().boolValue
}
18 changes: 0 additions & 18 deletions stdlib/objc/ObjectiveC/ObjectiveC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -209,21 +209,3 @@ public func autoreleasepool(@noescape code: () -> ()) {
let YES = ObjCBool(true)
@availability(*, unavailable, message="Use 'Bool' value 'false' instead") public
let NO = ObjCBool(false)

// FIXME: We can't make the fully-generic versions @transparent due to
// rdar://problem/17872402, so here are some @transparent overloads
// for ObjCBool
@transparent
public func && <T: BooleanType>(
lhs: T, @autoclosure rhs: () -> ObjCBool
) -> Bool {
return lhs.boolValue ? rhs().boolValue : false
}

@transparent
public func || <T: BooleanType>(
lhs: T, @autoclosure rhs: () -> ObjCBool
) -> Bool {
return lhs.boolValue ? true : rhs().boolValue
}

0 comments on commit 654dab2

Please sign in to comment.