-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SR-6690] ObjectMapper project in source compatibility suite broken by fix for SR-6685 #49239
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
Comments
I think we're going to need to ask the project to update here. The changes I'm preparing for eliminating IUOs from the type system will expose the same problem and will necessarily mean that we cannot put this under some form of version check. |
cc @lplarson I'd be happy to say that this is downgraded to a warning in old modes, but that the function is then marked unavailable or something so that it never gets picked in overload resolution. That's better than just making it a hard error all the time. |
@belkadan I don't see a way to do anything like that. The problem is that we literally replace Removing {{IUO}} from the type system makes it impossible to distinguish the two cases. |
I don't see an easy way to do it, but in practice we could hardcode something like "does this function have |
I'll look into whether there is a better option here. My concern is that having two I can certainly look at hacking the diagnostic to emit a warning in these cases, but I'll point out that changing the behavior os that the @DougGregor any thoughts on this? |
I looked into this a little further. Once IUOs are removed from the type system we'll mangle the two names the same way which obviously results in lots of badness. I don't think there's a good answer here. As I said with IUOs in the type system we can certainly conditionalize this, but once they're removed we're back to a breaking change here. |
The best we could probably do here would be to emit a warning in Swift 4.1 (but otherwise not change the behavior), which will become a hard error in Swift 5 when the two declarations would collide. Beyond "it's nice to provide a warning before breaking things", this has a second advantage: with the elimination of IUOs from the type system, something like this will work: func f(_: inout Int?) { }
var x: Int! = nil
f(&x) // currently an error because IUO types != Optional types. So the correct fix in Swift 5 will be "delete the IUO overload"; one won't have to change any IUO callers. |
I updated #13680 to emit the warning rather than error on master, and will cherry-pick this to swift-4.1-branch. Leaving this open to track the fact that the issue will still need to be addressed once the IUO changes go in. |
In #14244 I added the ability pass as This makes the previous warning something you can take action on - remove the second overload and code should continue to work. My PR for removing IUO from the type system is now here: #14299 I expect to merge very soon (possibly today). The PR to XFAIL ObjectMapper is here: swiftlang/swift-source-compat-suite#127 SwiftLint is using an older version of SourceKitten that does not include @jpsim PR jpsim/SourceKitten#445 so that will need to be XFAILed as well until the dependencies are updated. |
Comment by Nicole Jacque (JIRA) @rudkx, is this getting fixed on 4.1 and 5.0 branches? That PR was only on master. |
najacque (JIRA User) The |
Comment by Nicole Jacque (JIRA) Ok, so it sounds like we need to ask ObjectMapper's maintainers to make a change. @lplarson can you please reach out to the maintainer? |
Reached out to project maintainer requesting a project hash update with a fix. |
Comment by Nicole Jacque (JIRA) @swift-ci create |
I've sent another email requesting an updated hash. |
Looks like they've updated the project to build with 4.2, and it passes a project_precommit_check. I've opened a pull request to update a new hash in the suite. |
Testing passed, #227 merged. Issue resolved. |
Additional Detail from JIRA
md5: 856cbd26e1ce6ec8571a8765cc6aa095
Issue Description:
The fix for https://bugs.swift.org/browse/SR-6685 exposes a problem in the ObjectMapper project in the source compatibility suite.
The project has functions overloaded by both
'inout T?'
and'inout T!'
, which should never have been allowed by the compiler for any version of Swift.For example:
The text was updated successfully, but these errors were encountered: