Apologies if this isn't the right category; I'm not quite sure where to put this.
I've found what appears to be a compiler bug involving opaque types, which causes a segfault at runtime. The code to reproduce it is here: https://github.com/bbrk24/SEChatTUI/tree/7733c3fd6d109dad28d06b2d5c637f5e0db6d52d
If I run the code as-is, and enter a valid stack exchange user email and password, I get an error either for a 404 (bug in my own code) or a CAPTCHA (not much I can do about that). However, if I change some of the types in main.swift:
-let httpClient: HTTPClient = HTTPClientImpl() -let auth: AuthHandler = AuthHandlerImpl(client: httpClient) +let httpClient: some HTTPClient = HTTPClientImpl() +let auth: some AuthHandler = AuthHandlerImpl(client: httpClient)
All of a sudden, I get a segfault. According to the debugger, the signal occurs in "outlined init with copy of HTTPClient".
AuthHandlerImpl still stores an
any HTTPClient, so I don't see why the declared typings in main.swift should have any effect here. Am I doing something very wrong, or is this an actual bug?
Since it's probably relevant, I'm compiling and running this on an Ubuntu 18.04 VM on a Windows 10 machine (both x86_64).