-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
IRGenLLVM IR generationLLVM IR generationbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of software
Description
| Previous ID | SR-10532 |
| Radar | rdar://problem/50169558 |
| Original Reporter | @SusanDoggie |
| Type | Bug |
| Status | Resolved |
| Resolution | Done |
Environment
Swift 5
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, CompilerCrash, IRGen |
| Assignee | @slavapestov |
| Priority | Medium |
md5: 5b1ae800fe04f78f4be7ad25bcc37128
Issue Description:
The following code shouldn't have any error but swift compiler get it wrong.
public protocol ScalarProtocol: ScalarMultiplicative where Self == Scalar {
}
public protocol ScalarMultiplicative {
associatedtype Scalar : ScalarProtocol
}
public protocol MapReduceArithmetic : ScalarMultiplicative, Collection where Element : ScalarMultiplicative, Scalar == Element.Scalar {
}
public protocol Tensor : MapReduceArithmetic where Scalar : BinaryFloatingPoint, Element == Scalar {
var magnitude: Scalar { get set }
}
extension Tensor {
public var magnitude: Scalar {
return self.reduce(0) { $0 + $1 * $1 }.squareRoot()
}
}Metadata
Metadata
Assignees
Labels
IRGenLLVM IR generationLLVM IR generationbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of software