Skip to content

Please backport .swiftinterface fixes to 6.2 #2369

@Wilfred

Description

@Wilfred

Swift version

Swift 6.2

Platform

No response

Editor

No response

Description

#1887 changed OpenInterface.swift as follows:

let urlData = GeneratedInterfaceDocumentURLData(
  moduleName: moduleName,
  groupName: groupName,
  sourcekitdDocumentName: "\(moduleName)-\(UUID())",
  primaryFile: document
)

Since GeneratedInterfaceDocumentURLData implements Hashable and hence Equatable, each request is unique. As a result, we never get any cache hits in GeneratedInterfaceManager.swift:

guard let cachedIndex = openInterfaces.firstIndex(where: { $0.url == document }) else {
  return nil
}

This makes .swiftinterface requests noticeably slower in my usage.

This was subsequently fixed in #2233, but that's only in Swift 6.3. Could we backport that PR to 6.2? The commits apply cleanly to 6.2 too.

Steps to Reproduce

Open any Swift file with import Foundation and attempt a go-to-def (F12) on Foundation repeatedly. Observe that the

Logging

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions