Open aciidgh opened 7 years ago
Comment by Kyle Jessup (JIRA)
Compiling a SPM package containing only the following code will cause the crash:
func parserBody(data: UnsafePointer<Int8>?, length: Int) -> Int {
data?.withMemoryRebound(to: UInt8.self, capacity: length) {
data in
for i in 0..<length {
}
}
return 0
}
Thanks badthing (JIRA User) for the reduced test case
Assertion failed: (!outerOrigType.isTuple()), function planTupleIntoDirectResult, file /Volumes/Data/swift-public/swift/lib/SILGen/SILGenPoly.cpp, line 1851.
It looks like we infer the wrong result type for the closure:
(optional_evaluation_expr implicit type='()?' location=<stdin>:2:8 range=[<stdin>:2:2 - line:7:2]
(call_expr type='()?' location=<stdin>:2:8 range=[<stdin>:2:2 - line:7:2] nothrow arg_labels=to:capacity:_:
(dot_syntax_call_expr type='(UInt8.Type, Int, (UnsafePointer<UInt8>) throws -> ()?) throws -> ()?' location=<stdin>:2:8 range=[<stdin>:2:2 - line:2:8] nothrow
so over to the type-checker. (I think we've seen this before too.)
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler | |Labels | Bug, CompilerCrash, TypeChecker | |Assignee | None | |Priority | Medium | md5: c58c8e0d14408796846fbe80b3fba3e1Issue Description:
$ xcrun --find swift
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-11-15-a.xctoolchain/usr/bin/swift
$ git clone https://github.com/PerfectlySoft/PerfectTemplate
$ swift build