-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Fastlane.Swift] Fix OptionalConfigValue
for Any
-based types.
#18664
[Fastlane.Swift] Fix OptionalConfigValue
for Any
-based types.
#18664
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a minor suggestion to make it simpler but LGTM
@@ -325,7 +326,7 @@ def implementation | |||
implm += "let args: [RubyCommand.Argument] = []\n" | |||
else | |||
implm += "let args = [#{args.group_by { |h| h[:name] }.keys.join(",\n")}]\n" | |||
implm += ".compactMap { $0 }\n" | |||
implm += ".compactMap { $0?.nilify(when: { $0.value == nil }) }\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implm += ".compactMap { $0?.nilify(when: { $0.value == nil }) }\n" | |
implm += ".filter { $0?.value != nil }\n" |
What about this? Isn't this simpler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️ I'm an idiot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't exactly doing that, but gave me the idea to get rid of the nilify
method ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried doing incrementBuildNumber(buildNumber: 5)
but I got 👇
value of protocol type 'Any' cannot conform to 'ExpressibleByIntegerLiteral'; only struct/enum/class types can conform to protocols
Am I doing something wrong? 😇
But it works fine with you for float and string values?🤔 EDIT: I fixed it I think (tested as much as I could) |
I tried the
for the following code:
If I do without string interpolation it works fine. Thanks. Since I'm coming from 18654, I'll just drop this here. |
@RyuX51 could you check that your issue is solved now? |
@minuscorp I'm sorry, |
|
It's
and
also lead to the same error whereas
is just fine. |
I just tested using let string = "Foo"
echo(message: "Message \(string)") Working🤔 |
So this should be the right commit, right?
And when I add the
|
@minuscorp Even |
I'd reset the repo and try to run the |
@joshdholtz Can you replicate the issue or it is working fine for you?🤔 |
Any news @RyuX51 regarding the issue with interpolation? |
@minuscorp Well, I haven't investigated further. I just set up a new project where I wanted to try a Fastlane.swift for the first time. The fact that I get this error while wanting to show a value in an informational output is not really a blocker for me. This problem just sounded a lot like what you are fixing here is related, and I just wanted to let you know. Since you can't even replicate the bug, I don't want to bother you with it any longer. |
@minuscorp I’m still getting… value of protocol type 'Any' cannot conform to 'ExpressibleByUnicodeScalarLiteral'; only struct/enum/class types can conform to protocols when my incrementBuildNumber(buildNumber: "5") Are you not getting that same thing? 🤔 |
@joshdholtz indeed, I removed all conformances to incrementBuildNumber(buildNumber: 1.0, xcodeproj: "asd")
incrementBuildNumber(buildNumber: "1.0")
incrementBuildNumber(buildNumber: 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for me! ❤️ LGTM
Merge whenever you are ready
Hey @minuscorp 👋 Thank you for your contribution to fastlane and congrats on getting this pull request merged 🎉 Please let us know if this change requires an immediate release by adding a comment here 👍 |
Congratulations! 🎉 This was released as part of fastlane 2.184.0 🚀 |
Checklist
bundle exec rspec
from the root directory to see all new and existing tests passbundle exec rubocop -a
to ensure the code style is validMotivation and Context
OptionalConfigValue
does not provide anExpressibleBy
interface forAny?
parameters, so they have to be filtered out afterwards.Fixes #18654
Description
OptionalConfigItem
does not apply toAny
types to avoid a breaking compatibility against past releases. This PR resolves the issue.Testing Steps
Any
value:nil
.