mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix lifetime dependence diagnostics on Void types.
Allow a dependence on Void to be considered immortal. This is the ultimate
override in cases where no other code pattern is supported yet.
(cherry picked from commit 36d2b5bee4)
This commit is contained in:
@@ -199,9 +199,16 @@ private struct DiagnoseDependence {
|
||||
if function.hasUnsafeNonEscapableResult {
|
||||
return .continueWalk
|
||||
}
|
||||
// If the dependence scope is global, then it has immortal lifetime.
|
||||
if case .global = dependence.scope {
|
||||
// Check for immortal lifetime.
|
||||
switch dependence.scope {
|
||||
case .global:
|
||||
return .continueWalk
|
||||
case let .unknown(value):
|
||||
if value.type.isVoid {
|
||||
return .continueWalk
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
// Check that the parameter dependence for this result is the same
|
||||
// as the current dependence scope.
|
||||
|
||||
Reference in New Issue
Block a user