Skip to content

Commit

Permalink
Add failing test case for #676
Browse files Browse the repository at this point in the history
  • Loading branch information
ileitch committed Dec 18, 2023
1 parent 7ea2f4c commit 8732653
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import Shared
/// assume that all properties are in use, as they may be referenced by synthesized code.
final class EncodablePropertyRetainer: SourceGraphMutator {
private let graph: SourceGraph
private let configuration: Configuration
private let externalCodableProtocols: [String]

required init(graph: SourceGraph, configuration: Configuration) {
self.graph = graph
self.configuration = configuration
self.externalCodableProtocols = configuration.externalEncodableProtocols + configuration.externalCodableProtocols
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class FixtureClass219 {
init(foo: Int) {}
}

public class FixtureClass219Retainer {
typealias FixtureClass219Aliased = FixtureClass219

public func retain() {
_ = Self.FixtureClass219Aliased(foo: 1)
}
}
11 changes: 11 additions & 0 deletions Tests/PeripheryTests/RetentionTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1564,4 +1564,15 @@ final class RetentionTest: FixtureSourceGraphTestCase {
}
}
}

// https://github.com/peripheryapp/periphery/issues/676
func testRetainsInitializerCalledOnTypeAlias() {
guard performKnownFailures else { return }

analyze(retainPublic: true) {
assertReferenced(.class("FixtureClass219")) {
self.assertReferenced(.functionConstructor("init(foo:)"))
}
}
}
}

0 comments on commit 8732653

Please sign in to comment.