New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-6754] Swift Compiler Crash using Swift 4.1 toolchain with (!ty->hasError() && "Serializing error type"), function addTypeRef assertion failure #49303
Comments
Thanks for filing. I'm kind of surprised by the build log, which seems to be missing a bunch of information. I haven't tried looking at the project yet, but if you've got time it would be great to see if you can reproduce the issue with a smaller set of files. Failing that, just getting the full output from the compiler when it fails would be nice—there should be a backtrace and some extra information about what it was doing at the time. |
I would love to help you. I tried to do some investigate but I can't see any information on what file that caused this. However I'll try to reduce the set of files that could reproduce this issue |
Do you have any recommend command or log files that would like me to attach here? |
@belkadan Good news here. I was investigating and found that the file that caused this bug is `URLQueryItemEncoder.swift` which I copy from my another open-source project So I try building that project with Swift 4.1 development snapshot and it fails too. That project has only 1 swift file which should be a lot easier for you to investigate? |
Oh, excellent! Thanks a lot, Pitiphong; that makes things much easier. Here's the backtrace I get for that, including the "pretty stack info" at the bottom:
That is a very suspicious "While serializing type 'τ_1_0'"! It looks like a type variable leaked out of the type checker…so over to them. @xedin? |
(tested with |
I tried again with Swift 4.1 development snapshot 2018-01-23 and it still failed. However it works great in the Xcode 9.3 beta |
That's just the difference between asserts on and asserts off. It could very possibly be miscompiling. |
Yeah, I agree
You meant the cause of this bug may be a miscompiling? |
No, I mean the fact that it "works" in Xcode 9.3 could mean that the compiler is outputting incorrect code without recognizing it. |
I see and got it 🙂 |
@pitiphong-p I've tried the latest beta Xcode with 4.1 nightly toolchain from 02/08 (and default toolchain as well) and 'swift-4.1' branch built successfully, can you please try as well? |
The problem is still persists in the Xcode 9.2 and 9.3 with nightly toolchain from 02/08 and 4.1 development 02/08 on my machine |
@pitiphong-p Thanks! I'm going to try and reproduce then. |
It looks like the problem here is that structs/classes like `KeyedContainer` do not actually conform to `KeyedEncodingContainerProtocol` and `UnkeyedEncodingContainer` since there are multiple `encode` implementations missing, but for some reason we don't diagnose that properly and just let it all fall-through to serialization... |
@xedin Great to hear some update on this. Please feel free to ask me if you want me help on this issue 🙂 |
1 similar comment
@xedin Great to hear some update on this. Please feel free to ask me if you want me help on this issue 🙂 |
Comment by Enrique Lacal (JIRA) I can also reproduce this exact issue on Swift 4.1. I have the code as a git repo [here|https://github.com/EnriqueL8/SwiftBug.] Uncommenting two lines in the Model.swift makes the issue go away... |
@pitiphong-p enriquel8 (JIRA User) I have PR to fix this #16023 hope to get it in soon. |
Comment by Enrique Lacal (JIRA) Thanks! |
@xedin Thank you for your help. I hope it will get approved soon 🙂 |
Changed got merged into master. Please use nightly snapshot of master available tomorrow (or day after) to validate. |
enriquel8 (JIRA User) The problem with the project you mentioned hides in the ordering of the `dropTable` if you move it to the end I think it might be only temporary workaround... |
@xedin It works now!!! Thank you so much |
Comment by Enrique Lacal (JIRA) Hey @xedin, the workaround with the ordering of the `dropTable` did not seem to work... any other workaround? |
enriquel8 (JIRA User) Maybe try moving all of the methods after last `findAll` to the top to make it so block of `findAll` is the last. |
Attachment: Download
Environment
Xcode 9.2, Swift 4.1 Development Snapshot 2018-01-12, MacBook Pro 13" late 2015 macOS 10.13.2
Additional Detail from JIRA
md5: d1f2be406482197087c0b06371cd5c1e
Issue Description:
Hi, Swift team
We've tried to update our open-sourced Swift library to support Swift 4.1 with the Swift 4.1 Development Toolchain 2018-01-12. However it results with the Compiler Crash with assertion failure
You can try with our open-sourced Swift repo
https://github.com/pitiphong-p/URLQueryItemEncoder
The text was updated successfully, but these errors were encountered: