Skip to content

[SR-11223] Generics Type Resolution Regression on Linux DEVELOPMENT-SNAPSHOT-2019-07-26-a (61261fcddf) #53624

Closed
@Mordil

Description

@Mordil
Previous ID SR-11223
Radar rdar://problem/53664957
Original Reporter @Mordil
Type Bug
Status Resolved
Resolution Done
Environment

Ubuntu 16.04

Swift DEVELOPMENT-SNAPSHOT-2019-07-26-a

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, 5.2Regression
Assignee @theblixguy
Priority Medium

md5: 665b8c631694dff27c64b4d3ef5cb046

Issue Description:

RediStack builds against the nightly Swift builds on Ubuntu 16.04 to catch any errors that might crop up in the future.

Between 2 weeks ago and now, I am seeing an assertion failure that states

Assertion failed: file /redi-stack/.build/checkouts/swift-nio/Sources/NIO/NIOAny.swift, line 75

while running unit tests.

Which in NIOAny.swift is

@inlinable
init<T>(_ value: T) {
    switch value {
    ... // omitted for sake of brevity
    default:
        assert(!(value is NIOAny)) // assert that is triggered
        self = .other(value)
    }
} 

This initializer is triggered from these methods in SwiftNIO's Channel.swift:

    public func write<T>(_ any: T) -> EventLoopFuture<Void> {

        return self.write(NIOAny(any))

    }

    public func write<T>(_ any: T, promise: EventLoopPromise<Void>?) {

        self.write(NIOAny(any), promise: promise)

    }

    public func writeAndFlush<T>(_ any: T) -> EventLoopFuture<Void> {

        return self.writeAndFlush(NIOAny(any))

    }

    public func writeAndFlush<T>(_ any: T, promise: EventLoopPromise<Void>?) {

        self.writeAndFlush(NIOAny(any), promise: promise)

    }

Which are called by this single code snippet in RedisConnection.swift:

// 'command' is a local variable of the struct 'RedisCommand'
// that holds a reference to an 'EventLoopPromise<RESPValue>' class
// and 'RESPValue' enum with associated types

if self.sendCommandsImmediately {
    return channel.writeAndFlush(command).flatMap { promise.futureResult }
} else {
    return channel.write(command).flatMap { promise.futureResult }
}

Full stack trace:

Current stack trace:
0    libswiftCore.so      0x00007f3f2c58f652    swift_reportError + 50 
1    libswiftCore.so      0x00007f3f2c5fdc53    _swift_stdlib_reportFatalErrorInFile + 115 
2    libswiftCore.so      0x00007f3f2c52a7b8    function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Exploded> of closure #&#8203;1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #&#8203;1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #&#8203;1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.String, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 296 
3    libswiftCore.so      0x00007f3f2c52a947    function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Exploded> of closure #&#8203;1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #&#8203;1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.String, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 87 
4    libswiftCore.so      0x00007f3f2c2ffa62    function signature specialization <Arg[1] = [Closure Propagated : closure #&#8203;1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in closure #&#8203;1 (Swift.UnsafeBufferPointer<Swift.UInt8>) -> () in Swift._assertionFailure(_: Swift.StaticString, _: Swift.String, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never, Argument Types : [Swift.StaticStringSwift.UnsafeBufferPointer<Swift.UInt8>Swift.UIntSwift.UInt32]> of generic specialization <()> of Swift.String.withUTF8<A>((Swift.UnsafeBufferPointer<Swift.UInt8>) throws -> A) throws -> A + 258 
5    libswiftCore.so      0x00007f3f2c4fb734    function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded> of Swift._assertionFailure(_: Swift.StaticString, _: Swift.String, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 516 
6    libswiftCore.so      0x00007f3f2c2ff0a9    Swift._assertionFailure(_: Swift.StaticString, _: Swift.String, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 25 
7    redi-stackPackageTests.xctest 0x00005556f235e1c6    NIO.NIOAny._NIOAny.init<A>(A) -> NIO.NIOAny._NIOAny + 2214 at NIOAny.swift:75
8    redi-stackPackageTests.xctest 0x00005556f235d8b2    NIO.NIOAny.init<A>(A) -> NIO.NIOAny + 162 at NIOAny.swift:54
9    redi-stackPackageTests.xctest 0x00005556f22bef91    (extension in NIO):NIO.Channel.writeAndFlush<A>(A1) -> NIO.EventLoopFuture<()> + 129 at Channel.swift:246
10   redi-stackPackageTests.xctest 0x00005556f22befb0    (extension in NIO):NIO.Channel.writeAndFlush<A>(A1) -> NIO.EventLoopFuture<()> + 160 at Channel.swift:246
11   redi-stackPackageTests.xctest 0x00005556f2413a72    RediStack.RedisConnection.send(command: Swift.String, with: Swift.Array<RediStack.RESPValue>) -> NIO.EventLoopFuture<RediStack.RESPValue> + 2434 at RedisConnection.swift:213
12   redi-stackPackageTests.xctest 0x00005556f2415950    protocol witness for RediStack.RedisClient.send(command: Swift.String, with: Swift.Array<RediStack.RESPValue>) -> NIO.EventLoopFuture<RediStack.RESPValue> in conformance RediStack.RedisConnection : RediStack.RedisClient in RediStack + 16 at <compiler-generated>:0
13   redi-stackPackageTests.xctest 0x00005556f2400c87    (extension in RediStack):RediStack.RedisClient.set<A where A1: RediStack.RESPValueConvertible>(_: Swift.String, to: A1) -> NIO.EventLoopFuture<()> + 503 at StringCommands.swift:87
14   redi-stackPackageTests.xctest 0x00005556f241bbc2    RediStackIntegrationTests.BasicCommandsTests.test_delete() throws -> () + 1138 at BasicCommandsTests.swift:26
15   redi-stackPackageTests.xctest 0x00005556f2494a29    partial apply forwarder for RediStackIntegrationTests.BasicCommandsTests.test_delete() throws -> () + 9 at <compiler-generated>:0
16   redi-stackPackageTests.xctest 0x00005556f228c8cf    reabstraction thunk helper from @escaping @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) + 15 at <compiler-generated>:0
17   redi-stackPackageTests.xctest 0x00005556f2494a14    reabstraction thunk helper from @escaping @callee_guaranteed () -> (@error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error)partial apply forwarder with unmangled suffix ".385" + 20 at <compiler-generated>:0
18   libXCTest.so         0x00007f3f2c7fdf11    partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed () -> (@out (), @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@error @owned Swift.Error) + 17 
19   libXCTest.so         0x00007f3f2c7fdd1e    partial apply forwarder for closure #&#8203;1 (XCTest.XCTestCase) throws -> () in XCTest.(test in _3BE257A46ADB477C7BF2D39968B39F9D)<A where A: XCTest.XCTestCase>((A) -> () throws -> ()) -> (XCTest.XCTestCase) throws -> () + 78 
20   libXCTest.so         0x00007f3f2c7fdc94    partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error) + 20 
21   libXCTest.so         0x00007f3f2c7fe819    reabstraction thunk helper from @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error)partial apply forwarder with unmangled suffix ".16" + 9 
22   libXCTest.so         0x00007f3f2c7f0bd7    partial apply forwarder for reabstraction thunk helper from @escaping @callee_guaranteed (@in_guaranteed XCTest.XCTestCase) -> (@out (), @error @owned Swift.Error) to @escaping @callee_guaranteed (@guaranteed XCTest.XCTestCase) -> (@error @owned Swift.Error) + 39 
23   libXCTest.so         0x00007f3f2c7fcfe9    XCTest.XCTestCase.invokeTest() -> () + 73 
24   libXCTest.so         0x00007f3f2c7fccac    XCTest.XCTestCase.perform(XCTest.XCTestRun) -> () + 172 
25   libXCTest.so         0x00007f3f2c800f1f    XCTest.XCTest.run() -> () + 191 
26   libXCTest.so         0x00007f3f2c7feb78    XCTest.XCTestSuite.perform(XCTest.XCTestRun) -> () + 232 
27   libXCTest.so         0x00007f3f2c800f1f    XCTest.XCTest.run() -> () + 191 
28   libXCTest.so         0x00007f3f2c7feb78    XCTest.XCTestSuite.perform(XCTest.XCTestRun) -> () + 232 
29   libXCTest.so         0x00007f3f2c800f1f    XCTest.XCTest.run() -> () + 191 
30   libXCTest.so         0x00007f3f2c7feb90    XCTest.XCTestSuite.perform(XCTest.XCTestRun) -> () + 256 
31   libXCTest.so         0x00007f3f2c800f1f    XCTest.XCTest.run() -> () + 191 
32   libXCTest.so         0x00007f3f2c7fbc63    XCTest.XCTMain(Swift.Array<(testCaseClass: XCTest.XCTestCase.Type, allTests: Swift.Array<(Swift.String, (XCTest.XCTestCase) throws -> ())>)>) -> Swift.Never + 1091 
33   redi-stackPackageTests.xctest 0x00005556f24ddfa1    main + 321 at LinuxMain.swift:10
34   libc.so.6                          0x00007f3f2aa1b740 __libc_start_main + 240
35   redi-stackPackageTests.xctest 0x00005556f225fd69    _start + 41

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfregressionswift 5.2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions