@@ -24,7 +24,19 @@ import SwiftOptions
24
24
@_spi ( Testing) public var nodeFinder = NodeFinder ( )
25
25
26
26
/// Maps input files (e.g. .swift) to and from the DependencySource object.
27
- @_spi ( Testing) public private( set) var inputDependencySourceMap = InputDependencySourceMap ( )
27
+ ///
28
+ // FIXME: The map between swiftdeps and swift files is absolutely *not*
29
+ // a bijection. In particular, more than one swiftdeps file can be encountered
30
+ // in the course of deserializing priors *and* reading the output file map
31
+ // *and* re-reading swiftdeps files after frontends complete
32
+ // that correspond to the same swift file. These cause two problems:
33
+ // - overwrites in this data structure that lose data and
34
+ // - cache misses in `getInput(for:)` that cause the incremental build to
35
+ // turn over when e.g. entries in the output file map change. This should be
36
+ // replaced by a multi-map from swift files to dependency sources,
37
+ // and a regular map from dependency sources to swift files -
38
+ // since that direction really is one-to-one.
39
+ @_spi ( Testing) public private( set) var inputDependencySourceMap = BidirectionalMap < TypedVirtualPath , DependencySource > ( )
28
40
29
41
// The set of paths to external dependencies known to be in the graph
30
42
public internal( set) var fingerprintedExternalDependencies = Set < FingerprintedExternalDependency > ( )
@@ -1146,7 +1158,7 @@ extension Set where Element == ModuleDependencyGraph.Node {
1146
1158
}
1147
1159
}
1148
1160
1149
- extension InputDependencySourceMap {
1161
+ extension BidirectionalMap where T1 == TypedVirtualPath , T2 == DependencySource {
1150
1162
fileprivate func matches( _ other: Self ) -> Bool {
1151
1163
self == other
1152
1164
}
0 commit comments