Rightpoint / BonMot

Beautiful, easy attributed strings in Swift
MIT License
3.54k stars 197 forks source link

Compile error using XCode 9.3 beta #320

Closed mobilinked closed 6 years ago

mobilinked commented 6 years ago

Error message: "Binary operator '+=(::)' cannot be applied to operands of type ... At line# 136 in file StringStyle.swift

Br,

ZevEisenberg commented 6 years ago

Thanks for the report, @mobilinked! I'm not yet sure on whether this is a Swift 4.1 bug. I've filed it at https://bugs.swift.org/browse/SR-6915, and we'll see what the Swift team says. If it's expected behavior, I should be able to put together a fix. If you'd like to hack a local fix for now, you should be able to work around the issue with as [FontFeatureProvider] at the end of the lines in that file that are throwing that error. I'm guessing that fix will also improve compile times, so I may add it anyway.

mobilinked commented 6 years ago

Thanks much.

How about just to make it be simple as

if let numberCase = numberCase {
     featureProviders.append(numberCase)
}

The code is not that beautiful, but safe.

Br,

ZevEisenberg commented 6 years ago

Yep, I’ll probably change it to something like that. Just waiting on confirmation that it is desired behavior, since I don’t want to make any changes if it turns out to be a compiler bug.

ZevEisenberg commented 6 years ago

Reopening until it’s either fixed in a later beta, or I change it in BonMot.

ZevEisenberg commented 6 years ago

Sounds like it is a regression: https://bugs.swift.org/browse/SR-6915?focusedCommentId=32322&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-32322

On the off chance that it doesn't get fixed, we can still do a little cleanup here to make sure this compiles, especially during the beta for Xcode 9.3. @mobilinked any chance you'd be interested in submitting a PR?