Skip to content

Commit

Permalink
Disable external override bug workaround in >= 6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ileitch committed Dec 14, 2024
1 parent d52d79d commit 14005cf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Sources/SourceGraph/Mutators/ExternalOverrideRetainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ import Shared

/// Retains instance functions/vars that override external declarations.
///
/// It's not possible to determine if a declaration that overrides an external declaration is used, as the
/// external implementation may call the overridden declaration.
/// It's not possible to determine if a declaration that overrides an external declaration is used,
/// as the external implementation may call the overridden declaration.
final class ExternalOverrideRetainer: SourceGraphMutator {
private let graph: SourceGraph
private let isSwift6FixEnabled: Bool
private let isSwift60FixEnabled: Bool

required init(graph: SourceGraph, configuration _: Configuration, swiftVersion: SwiftVersion) {
self.graph = graph
isSwift6FixEnabled = swiftVersion.version.isVersion(greaterThanOrEqualTo: "6.0")
isSwift60FixEnabled = swiftVersion.version.isVersion(greaterThanOrEqualTo: "6.0") &&
swiftVersion.version.isVersion(lessThan: "6.1")
}

func mutate() {
Expand All @@ -38,7 +39,7 @@ final class ExternalOverrideRetainer: SourceGraphMutator {
}

// https://github.com/swiftlang/swift/issues/76628
if !didIdentifyRelatedRef, isSwift6FixEnabled {
if !didIdentifyRelatedRef, isSwift60FixEnabled {
graph.markRetained(decl)
}
}
Expand Down

0 comments on commit 14005cf

Please sign in to comment.