Skip to content

Nest SocketAddress in NIOHTTPServer#47

Merged
gjcairo merged 1 commit intoswift-server:mainfrom
aryan-25:nest-socket-address
Jan 13, 2026
Merged

Nest SocketAddress in NIOHTTPServer#47
gjcairo merged 1 commit intoswift-server:mainfrom
aryan-25:nest-socket-address

Conversation

@aryan-25
Copy link
Copy Markdown
Collaborator

Motivation:

The HTTPServer module defines a SocketAddress type, but this has the same name as the type in the NIOCore module.

Due to a compiler bug, when a module imports both HTTPServer and NIOCore, the HTTPServer module's SocketAddress type cannot be referenced, because HTTPServer also contains a protocol with the same name (the HTTPServer protocol). In this case, using the module name as a namespace qualifier doesn't work as intended:

import HTTPServer
import NIOCore

let a: SocketAddress // error: 'SocketAddress' is ambiguous for type lookup in this context

let b: HTTPServer.SocketAddress // error: 'SocketAddress' is not a member type of protocol 'HTTPServer.HTTPServer'

let c: NIOCore.SocketAddress // compiles fine.

Modifications:

Nested SocketAddress under NIOHTTPServer, since that type is only used in the concrete NIO implementation.

Result:

NIOHTTPServer.SocketAddress can be used without running into swiftlang/swift#43510.

@gjcairo gjcairo merged commit c949cfc into swift-server:main Jan 13, 2026
13 of 26 checks passed
@aryan-25 aryan-25 deleted the nest-socket-address branch January 26, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants