diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b810b32fd..e1ee0d0f4 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,20 +16,17 @@ jobs: env: UNIDOC_ENABLE_INDEXSTORE: "0" steps: - # Important! We install an Ubuntu 22.04 Swift toolchain, and not the 24.04 one - # because the 24.04 toolchain for some reason is built with assertions enabled, - # which causes the Swift compiler to crash when building the package. - name: Install Swift uses: tayloraswift/swift-install-action@master with: - swift-prefix: "swift-5.10.1-release/ubuntu2204/swift-5.10.1-RELEASE" - swift-id: "swift-5.10.1-RELEASE-ubuntu22.04" + swift-prefix: "swift-6.0-release/ubuntu2404/swift-6.0-RELEASE" + swift-id: "swift-6.0-RELEASE-ubuntu24.04" # This installs an older version of Unidoc, not the one we are testing. + # We use `--static-swift-stdlib` so it doesn’t matter if the Unidoc binary was + # built with a different version of Swift. - name: Install Unidoc uses: tayloraswift/swift-unidoc-action@master - with: - unidoc-version: "master" - name: Checkout repository uses: actions/checkout@v3 @@ -46,13 +43,16 @@ jobs: name: macOS env: UNIDOC_ENABLE_INDEXSTORE: "0" - DEVELOPER_DIR: "/Applications/Xcode_15.3.app/Contents/Developer" steps: + - name: Install Swift 6.0 + uses: tayloraswift/swift-install-action@master + with: + swift-prefix: "swift-6.0-release/xcode/swift-6.0-RELEASE" + swift-id: "swift-6.0-RELEASE" + - name: Install Unidoc uses: tayloraswift/swift-unidoc-action@master - with: - unidoc-version: "master" - name: Checkout repository uses: actions/checkout@v3 diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 45256998f..673460986 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -11,11 +11,13 @@ jobs: macos: runs-on: macos-14 name: macOS - - env: - DEVELOPER_DIR: "/Applications/Xcode_15.3.app/Contents/Developer" - steps: + - name: Install Swift 6.0 + uses: tayloraswift/swift-install-action@master + with: + swift-prefix: "swift-6.0-release/xcode/swift-6.0-RELEASE" + swift-id: "swift-6.0-RELEASE" + - name: Checkout repository uses: actions/checkout@v3 @@ -47,8 +49,8 @@ jobs: - name: Install Swift uses: tayloraswift/swift-install-action@master with: - swift-prefix: "swift-5.10.1-release/ubuntu2404/swift-5.10.1-RELEASE" - swift-id: "swift-5.10.1-RELEASE-ubuntu24.04" + swift-prefix: "swift-6.0-release/ubuntu2404/swift-6.0-RELEASE" + swift-id: "swift-6.0-RELEASE-ubuntu24.04" # This clobbers everything in the current directory, which is why we installed # the Swift toolchain in the home directory. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec6dc2f39..815c0a81c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,13 +10,7 @@ on: jobs: server: runs-on: ubuntu-24.04 - name: Amazon Linux 2023 - - strategy: - matrix: - image: - - tayloraswift/5.10.0-amazonlinux2023:latest - + name: Linux steps: - name: Checkout repository uses: actions/checkout@v3 @@ -39,7 +33,7 @@ jobs: --user root \ -v $PWD:/swift/swift-unidoc \ -w /swift/swift-unidoc \ - ${{ matrix.image }} \ + swift:6.0-noble \ /bin/bash .github/pipeline macos: @@ -47,9 +41,14 @@ jobs: name: macOS env: UNIDOC_ENABLE_INDEXSTORE: "1" - DEVELOPER_DIR: "/Applications/Xcode_15.3.app/Contents/Developer" steps: + - name: Install Swift 6.0 + uses: tayloraswift/swift-install-action@master + with: + swift-prefix: "swift-6.0-release/xcode/swift-6.0-RELEASE" + swift-id: "swift-6.0-RELEASE" + - name: Checkout repository uses: actions/checkout@v3 diff --git a/Package.resolved b/Package.resolved index 7e74122d1..db2e8b73c 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "14136142efb275ae01dcfeaf5849d265cd6cab460ea3b046c55ea7ccd4d3ab76", + "originHash" : "1285241c2a78115dc45f201aef02db9d1eeda9a0221d768c13bf21ebf6524a3a", "pins" : [ { "identity" : "indexstore-db", diff --git a/README.md b/README.md index 2874f8d32..d15983632 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,7 @@ Unidoc powers the [Swiftinit](https://swiftinit.org) open source package index! ## Requirements -Unidoc’s principal deployment target is Amazon Linux 2023, but the project also builds on macOS 14 with Xcode 15.3 or newer. - -Unidoc requires Swift 5.10. - -> Note: - Due to a known [compiler bug](https://github.com/apple/swift/issues/71606), it is not currently possible to build Unidoc on macOS with a non-Xcode toolchain. +Unidoc supports Linux and macOS. Unidoc requires Swift 6.0. ## Features diff --git a/Sources/SymbolGraphBuilderTests/Main.swift b/Sources/SymbolGraphBuilderTests/Main.swift index 9ded7bfbe..c59450905 100644 --- a/Sources/SymbolGraphBuilderTests/Main.swift +++ b/Sources/SymbolGraphBuilderTests/Main.swift @@ -268,7 +268,7 @@ enum Main:TestMain, TestBattery try workspace.build(package: try .remote( project: "swift-nio-ssl", from: "https://github.com/apple/swift-nio-ssl.git", - at: "2.24.0", + at: "2.27.2", in: workspace), with: toolchain) }) @@ -343,7 +343,7 @@ enum Main:TestMain, TestBattery try workspace.build(package: try .remote( project: "swift-snapshot-testing", from: "https://github.com/pointfreeco/swift-snapshot-testing.git", - at: "1.17.0", + at: "1.17.5", in: workspace), with: toolchain) }) @@ -369,7 +369,7 @@ enum Main:TestMain, TestBattery try workspace.build(package: try .remote( package: "indexstore-db", from: "https://github.com/apple/indexstore-db.git", - at: "swift-5.10-RELEASE", + at: "swift-6.0-RELEASE", in: workspace, flags: .init(cxx: ["-I/usr/lib/swift", "-I/usr/lib/swift/Block"])), with: toolchain) diff --git a/Sources/SymbolGraphCompiler/Extensions/SSGC.ExtensionSignatureError.swift b/Sources/SymbolGraphCompiler/Extensions/SSGC.ExtensionSignatureError.swift index 8621392f9..613125606 100644 --- a/Sources/SymbolGraphCompiler/Extensions/SSGC.ExtensionSignatureError.swift +++ b/Sources/SymbolGraphCompiler/Extensions/SSGC.ExtensionSignatureError.swift @@ -4,36 +4,34 @@ import Symbols extension SSGC { - struct ExtensionSignatureError:Error + enum ExtensionSignatureError:Error { - let expected:ExtensionSignature - let declared:[GenericConstraint]? - - init(expected:ExtensionSignature, - declared:[GenericConstraint]? = nil) - { - self.expected = expected - self.declared = declared - } + case conformance(expected:ExtensionSignature, declared:[GenericConstraint]) + case member (expected:ExtensionSignature, declared:[GenericConstraint]) } } extension SSGC.ExtensionSignatureError:CustomStringConvertible { var description:String { - if let _:[GenericConstraint] = self.declared + switch self { + case .conformance(expected: let expected, declared: let declared): """ - Cannot declare an extension (of \(self.expected.extendee)) containing \ - a symbol with different extension constraints than its extension block. - """ - } - else - { - """ - Cannot declare an extension (of \(self.expected.extendee)) containing \ + Cannot declare an extension (of \(expected.extendee)) containing \ a relationship with different extension constraints than its extension \ block. + + Extension block: \(expected.conditions.humanReadable) + Relationship: \(declared.humanReadable) + """ + case .member(expected: let expected, declared: let declared): + """ + Cannot declare an extension (of \(expected.extendee)) containing \ + a symbol with different extension constraints than its extension block! + + Extension block: \(expected.conditions.humanReadable) + Extension member: \(declared.humanReadable) """ } } diff --git a/Sources/SymbolGraphCompiler/GenericOperator (ext).swift b/Sources/SymbolGraphCompiler/GenericOperator (ext).swift new file mode 100644 index 000000000..84a3bfb20 --- /dev/null +++ b/Sources/SymbolGraphCompiler/GenericOperator (ext).swift @@ -0,0 +1,14 @@ +import Signatures + +extension GenericOperator +{ + var token:String + { + switch self + { + case .conformer: ":" + case .subclass: ":" + case .equal: "==" + } + } +} diff --git a/Sources/SymbolGraphCompiler/SSGC.SymbolDump.swift b/Sources/SymbolGraphCompiler/SSGC.SymbolDump.swift index 4c2872c19..23155448f 100644 --- a/Sources/SymbolGraphCompiler/SSGC.SymbolDump.swift +++ b/Sources/SymbolGraphCompiler/SSGC.SymbolDump.swift @@ -104,7 +104,7 @@ extension SSGC.SymbolDump } // Trim file path prefixes. guard - let base:Symbol.FileBase = base + let base:Symbol.FileBase = copy base else { $0.location = nil diff --git a/Sources/SymbolGraphCompiler/SSGC.TypeChecker.swift b/Sources/SymbolGraphCompiler/SSGC.TypeChecker.swift index 16796b04b..994f8a24e 100644 --- a/Sources/SymbolGraphCompiler/SSGC.TypeChecker.swift +++ b/Sources/SymbolGraphCompiler/SSGC.TypeChecker.swift @@ -311,7 +311,8 @@ extension SSGC.TypeChecker { // The member’s extension constraints don’t match the extension // object’s signature! - throw SSGC.ExtensionSignatureError.init(expected: group.signature, + throw SSGC.ExtensionSignatureError.member( + expected: group.signature, declared: member.conditions.sorted()) } @@ -379,10 +380,14 @@ extension SSGC.TypeChecker conformer = type - guard named.conditions == conditions + // This assertion disabled due to Apple Swift bug: + // https://github.com/swiftlang/swift/issues/76559 + guard named.conditions == conditions || { true }() else { - throw SSGC.ExtensionSignatureError.init(expected: named.signature) + throw SSGC.ExtensionSignatureError.conformance( + expected: named.signature, + declared: conformance.conditions) } } @@ -429,19 +434,19 @@ extension SSGC.TypeChecker (\(target)) of '\(type.value.path)' because multiple conflicting \ conformances unify to a heterogeneous set of constraints - Declared constraints: \(lists) - Simplified constraints: \(reduced) + Declared constraints: \(lists.map(\.humanReadable)) + Simplified constraints: \(reduced.humanReadable) """) } catch SSGC.ConstraintReductionError.redundant(let reduced, from: let lists) { throw AssertionError.init(message: """ Failed to simplify constraints for conditional conformance \ - (\(target)) of '\(type.value.path)' because at least one of the \ - constraint lists had redundancies within itself + (\(target)) of '\(type.value.path)' due to multiple conflicting conditional + conformances parsed from Swift compiler output - Declared constraints: \(lists) - Simplified constraints: \(reduced) + Declared constraints: \(lists.map(\.humanReadable)) + Simplified constraints: \(reduced.humanReadable) """) } } @@ -470,10 +475,30 @@ extension SSGC.TypeChecker return } - let canonical:Set> = try self.computeConformance( - where: overlapping, - to: target, - of: type) + let canonical:Set> + do + { + canonical = try self.computeConformance(where: overlapping, + to: target, + of: type) + } + catch let error + { + switch target + { + case "ss9EscapableP": print(error) + case "ss8CopyableP": print(error) + case "s11CoreMetrics06_SwiftB16SendableProtocolP": print(error) + default: throw error + } + + print(""" + Note: recovering from error due to known Apple Swift bug + https://github.com/swiftlang/swift/issues/76499 + + """) + return + } // Generate an implicit, internal extension for this conformance, // if one does not already exist. diff --git a/Sources/SymbolGraphCompiler/Sequence (ext).swift b/Sources/SymbolGraphCompiler/Sequence (ext).swift new file mode 100644 index 000000000..7c9c91d1c --- /dev/null +++ b/Sources/SymbolGraphCompiler/Sequence (ext).swift @@ -0,0 +1,24 @@ +import Signatures +import Symbols + +extension Sequence> +{ + var humanReadable:String + { + var string:String = "" + for clause:GenericConstraint in self + { + if !string.isEmpty + { + string += ", " + } + + switch clause + { + case .where(let parameter, is: let what, to: let type): + string += "\(parameter) \(what.token) \(type.spelling)" + } + } + return string + } +} diff --git a/Sources/Symbols/Identifiers/Symbol.Decl.swift b/Sources/Symbols/Identifiers/Symbol.Decl.swift index 00437e429..879143bf0 100644 --- a/Sources/Symbols/Identifiers/Symbol.Decl.swift +++ b/Sources/Symbols/Identifiers/Symbol.Decl.swift @@ -43,7 +43,8 @@ extension Symbol.Decl /// mangled suffix, returning nil if the suffix contains characters /// that are not allowed to appear in a symbol identifier. /// - /// Valid characters are `_`, `[A-Z]`, `[a-z]`, `[0-9]`, '(', ')', ':', '.', '-', and `@`. + /// Valid characters are `_`, `[A-Z]`, `[a-z]`, `[0-9]`, '(', ')', '*', ':', '.', '-', `@`, + /// `#`, and `$`. @inlinable public init?(_ language:Language, _ suffix:some StringProtocol) { @@ -55,6 +56,7 @@ extension Symbol.Decl { switch Unicode.Scalar.init(ascii) { + case "#": continue case "$": continue case "-": continue case ":": continue @@ -62,6 +64,7 @@ extension Symbol.Decl case "_": continue case "(": continue case ")": continue + case "*": continue case "0" ... "9": continue case "@": continue case "A" ... "Z": continue diff --git a/Sources/UnidocQueries/Packages/Unidoc.AliasResolutionQuery.swift b/Sources/UnidocQueries/Packages/Unidoc.AliasResolutionQuery.swift index a9de0dddb..c3b3c8bf4 100644 --- a/Sources/UnidocQueries/Packages/Unidoc.AliasResolutionQuery.swift +++ b/Sources/UnidocQueries/Packages/Unidoc.AliasResolutionQuery.swift @@ -1,4 +1,5 @@ import BSON +import MongoDB import MongoQL import UnidocDB import UnidocRecords @@ -19,12 +20,9 @@ extension Unidoc } } } -extension Unidoc.AliasResolutionQuery:Mongo.PipelineQuery -{ - typealias Iteration = Mongo.Single -} extension Unidoc.AliasResolutionQuery:Unidoc.AliasingQuery { + typealias Iteration = Mongo.Single typealias CollectionOrigin = Aliases typealias CollectionTarget = Targets diff --git a/Sources/UnidocQueries/Packages/Unidoc.AliasingQuery.swift b/Sources/UnidocQueries/Packages/Unidoc.AliasingQuery.swift index 362194569..d88bd9c30 100644 --- a/Sources/UnidocQueries/Packages/Unidoc.AliasingQuery.swift +++ b/Sources/UnidocQueries/Packages/Unidoc.AliasingQuery.swift @@ -12,8 +12,10 @@ extension Unidoc where CollectionOrigin.Element:Mongo.MasterCodingModel, Collation == SimpleCollation { + // https://forums.swift.org/t/recent-improvements-to-associated-type-inference/70265/14 override - associatedtype CollectionOrigin:Mongo.CollectionModel + associatedtype Collation + associatedtype CollectionTarget:Mongo.CollectionModel /// The field to store the target document (a `CollectionTarget.Element`) in. @@ -25,15 +27,6 @@ extension Unidoc func extend(pipeline:inout Mongo.PipelineEncoder) } } - -#if compiler(>=6.0) -extension Unidoc.AliasingQuery -{ - public - typealias Collation = SimpleCollation -} -#endif - extension Unidoc.AliasingQuery { @inlinable public diff --git a/Sources/UnidocQueries/Packages/Unidoc.RealmQuery.swift b/Sources/UnidocQueries/Packages/Unidoc.RealmQuery.swift index 37c732091..9d4460b67 100644 --- a/Sources/UnidocQueries/Packages/Unidoc.RealmQuery.swift +++ b/Sources/UnidocQueries/Packages/Unidoc.RealmQuery.swift @@ -24,13 +24,10 @@ extension Unidoc } } } -extension Unidoc.RealmQuery:Mongo.PipelineQuery +extension Unidoc.RealmQuery:Unidoc.AliasingQuery { public typealias Iteration = Mongo.Single -} -extension Unidoc.RealmQuery:Unidoc.AliasingQuery -{ public typealias CollectionOrigin = Unidoc.DB.RealmAliases public diff --git a/Sources/UnidocQueries/Packages/Unidoc.SitemapQuery.swift b/Sources/UnidocQueries/Packages/Unidoc.SitemapQuery.swift index 7757ed9e8..fbacf110a 100644 --- a/Sources/UnidocQueries/Packages/Unidoc.SitemapQuery.swift +++ b/Sources/UnidocQueries/Packages/Unidoc.SitemapQuery.swift @@ -20,13 +20,10 @@ extension Unidoc } } } -extension Unidoc.SitemapQuery:Mongo.PipelineQuery +extension Unidoc.SitemapQuery:Unidoc.AliasingQuery { public typealias Iteration = Mongo.Single -} -extension Unidoc.SitemapQuery:Unidoc.AliasingQuery -{ public typealias CollectionOrigin = Unidoc.DB.PackageAliases public diff --git a/Sources/UnidocQueries/Versions/Unidoc.EditionMetadataSymbolicQuery.swift b/Sources/UnidocQueries/Versions/Unidoc.EditionMetadataSymbolicQuery.swift index 0ed4dda9f..7af500a42 100644 --- a/Sources/UnidocQueries/Versions/Unidoc.EditionMetadataSymbolicQuery.swift +++ b/Sources/UnidocQueries/Versions/Unidoc.EditionMetadataSymbolicQuery.swift @@ -17,12 +17,9 @@ extension Unidoc } } } -extension Unidoc.EditionMetadataSymbolicQuery:Mongo.PipelineQuery -{ - typealias Iteration = Mongo.Single -} extension Unidoc.EditionMetadataSymbolicQuery:Unidoc.AliasingQuery { + typealias Iteration = Mongo.Single typealias CollectionOrigin = Unidoc.DB.PackageAliases typealias CollectionTarget = Unidoc.DB.Packages diff --git a/Sources/UnidocQueries/Versions/Unidoc.PackagePageQuery.swift b/Sources/UnidocQueries/Versions/Unidoc.PackagePageQuery.swift index 744fee1d8..2795b1382 100644 --- a/Sources/UnidocQueries/Versions/Unidoc.PackagePageQuery.swift +++ b/Sources/UnidocQueries/Versions/Unidoc.PackagePageQuery.swift @@ -31,16 +31,15 @@ extension Unidoc } } } -extension Unidoc.PackagePageQuery:Mongo.PipelineQuery +extension Unidoc.PackagePageQuery { - public - typealias Iteration = Mongo.Single - public typealias Output = Unidoc.PackagePageOutput } extension Unidoc.PackagePageQuery:Unidoc.AliasingQuery { + public + typealias Iteration = Mongo.Single public typealias CollectionOrigin = Unidoc.DB.PackageAliases public diff --git a/Sources/UnidocQueries/Versions/Unidoc.RefStateSymbolicQuery.swift b/Sources/UnidocQueries/Versions/Unidoc.RefStateSymbolicQuery.swift index 680b3a386..816914ae8 100644 --- a/Sources/UnidocQueries/Versions/Unidoc.RefStateSymbolicQuery.swift +++ b/Sources/UnidocQueries/Versions/Unidoc.RefStateSymbolicQuery.swift @@ -17,12 +17,9 @@ extension Unidoc } } } -extension Unidoc.RefStateSymbolicQuery:Mongo.PipelineQuery -{ - typealias Iteration = Mongo.Single -} extension Unidoc.RefStateSymbolicQuery:Unidoc.AliasingQuery { + typealias Iteration = Mongo.Single typealias CollectionOrigin = Unidoc.DB.PackageAliases typealias CollectionTarget = Unidoc.DB.Packages diff --git a/Sources/UnidocQueries/Versions/Unidoc.RulesQuery.swift b/Sources/UnidocQueries/Versions/Unidoc.RulesQuery.swift index a7d4e9014..a8076a060 100644 --- a/Sources/UnidocQueries/Versions/Unidoc.RulesQuery.swift +++ b/Sources/UnidocQueries/Versions/Unidoc.RulesQuery.swift @@ -24,13 +24,10 @@ extension Unidoc } } } -extension Unidoc.RulesQuery:Mongo.PipelineQuery +extension Unidoc.RulesQuery:Unidoc.AliasingQuery { public typealias Iteration = Mongo.Single -} -extension Unidoc.RulesQuery:Unidoc.AliasingQuery -{ public typealias CollectionOrigin = Unidoc.DB.PackageAliases public diff --git a/Sources/UnidocQueries/Versions/Unidoc.TagsQuery.swift b/Sources/UnidocQueries/Versions/Unidoc.TagsQuery.swift index 613940220..07bbb8ac6 100644 --- a/Sources/UnidocQueries/Versions/Unidoc.TagsQuery.swift +++ b/Sources/UnidocQueries/Versions/Unidoc.TagsQuery.swift @@ -37,13 +37,10 @@ extension Unidoc } } } -extension Unidoc.TagsQuery:Mongo.PipelineQuery +extension Unidoc.TagsQuery:Unidoc.AliasingQuery { public typealias Iteration = Mongo.Single -} -extension Unidoc.TagsQuery:Unidoc.AliasingQuery -{ public typealias CollectionOrigin = Unidoc.DB.PackageAliases public diff --git a/Sources/UnidocQueries/Versions/Unidoc.VersionsQuery.swift b/Sources/UnidocQueries/Versions/Unidoc.VersionsQuery.swift index b58ffc153..e79c344d7 100644 --- a/Sources/UnidocQueries/Versions/Unidoc.VersionsQuery.swift +++ b/Sources/UnidocQueries/Versions/Unidoc.VersionsQuery.swift @@ -40,13 +40,10 @@ extension Unidoc } } } -extension Unidoc.VersionsQuery:Mongo.PipelineQuery +extension Unidoc.VersionsQuery:Unidoc.AliasingQuery { public typealias Iteration = Mongo.Single -} -extension Unidoc.VersionsQuery:Unidoc.AliasingQuery -{ public typealias CollectionOrigin = Unidoc.DB.PackageAliases public diff --git a/Sources/UnidocQueries/Volumes/Unidoc.RedirectQuery.swift b/Sources/UnidocQueries/Volumes/Unidoc.RedirectQuery.swift index faf326cf2..bcb1d9bb7 100644 --- a/Sources/UnidocQueries/Volumes/Unidoc.RedirectQuery.swift +++ b/Sources/UnidocQueries/Volumes/Unidoc.RedirectQuery.swift @@ -4,10 +4,6 @@ import Unidoc import UnidocDB import UnidocRecords -@available(*, deprecated, renamed: "Unidoc.RedirectQuery") -public -typealias ThinQuery = Unidoc.RedirectQuery - extension Unidoc { @frozen public @@ -27,13 +23,10 @@ extension Unidoc } } } -extension Unidoc.RedirectQuery:Mongo.PipelineQuery +extension Unidoc.RedirectQuery:Unidoc.VolumeQuery { public typealias Iteration = Mongo.Single -} -extension Unidoc.RedirectQuery:Unidoc.VolumeQuery -{ /// The compiler is capable of inferring this on its own, but this makes it easier to /// understand how this type witnesses ``Unidoc.VolumeQuery``. public diff --git a/Sources/UnidocQueries/Volumes/Unidoc.VertexQuery.swift b/Sources/UnidocQueries/Volumes/Unidoc.VertexQuery.swift index 709c7a29d..f7132b4cd 100644 --- a/Sources/UnidocQueries/Volumes/Unidoc.VertexQuery.swift +++ b/Sources/UnidocQueries/Volumes/Unidoc.VertexQuery.swift @@ -61,17 +61,14 @@ extension Unidoc.VertexQuery unset: unset.map { Unidoc.AnyVertex[$0] }) } } -extension Unidoc.VertexQuery:Mongo.PipelineQuery -{ - public - typealias Iteration = Mongo.Single -} extension Unidoc.VertexQuery:Unidoc.VolumeQuery { /// The compiler is capable of inferring this on its own, but this makes it easier to /// understand how this type witnesses ``Unidoc.VolumeQuery``. public typealias VertexPredicate = Unidoc.Shoot + public + typealias Iteration = Mongo.Single @inlinable public static var volumeOfLatest:Mongo.AnyKeyPath? { Unidoc.PrincipalOutput[.volumeOfLatest] } diff --git a/Sources/UnidocQueries/Volumes/Unidoc.VolumeQuery.swift b/Sources/UnidocQueries/Volumes/Unidoc.VolumeQuery.swift index e7f04276e..05dea938d 100644 --- a/Sources/UnidocQueries/Volumes/Unidoc.VolumeQuery.swift +++ b/Sources/UnidocQueries/Volumes/Unidoc.VolumeQuery.swift @@ -6,8 +6,15 @@ import UnidocRecords extension Unidoc { public - protocol VolumeQuery:Mongo.PipelineQuery where Collation == VolumeCollation + protocol VolumeQuery:Mongo.PipelineQuery + where CollectionOrigin == Unidoc.DB.Volumes, Collation == VolumeCollation { + // https://forums.swift.org/t/recent-improvements-to-associated-type-inference/70265/14 + override + associatedtype CollectionOrigin + override + associatedtype Collation + associatedtype VertexPredicate:Unidoc.VertexPredicate var volume:VolumeSelector { get } @@ -35,17 +42,6 @@ extension Unidoc func extend(pipeline:inout Mongo.PipelineEncoder) } } - -#if compiler(>=6.0) -extension Unidoc.VolumeQuery -{ - public - typealias CollectionOrigin = Unidoc.DB.Volumes - public - typealias Collation = VolumeCollation -} -#endif - extension Unidoc.VolumeQuery { @inlinable public static diff --git a/Sources/UnidocServer/Server/Unidoc.ServerLogger.swift b/Sources/UnidocServer/Server/Unidoc.ServerLogger.swift index a1d9feb92..c415cb869 100644 --- a/Sources/UnidocServer/Server/Unidoc.ServerLogger.swift +++ b/Sources/UnidocServer/Server/Unidoc.ServerLogger.swift @@ -6,7 +6,7 @@ import UnixTime extension Unidoc { public - protocol ServerLogger:AnyActor + protocol ServerLogger:Actor { func dashboard(from server:Server, as format:Unidoc.RenderFormat) async -> HTTP.Resource