Closed kawoou closed 5 years ago
That was quick! 😆
Are there other things we can potentially migrate? There are new String
protocols, and other things (see https://www.whatsnewinswift.com).
Instead of peppering the code with #if swift
checks, we add backports for new functions. See the _SwiftSupport.swift
file:
https://github.com/stencilproject/Stencil/blob/master/Sources/_SwiftSupport.swift
Any word on this PR? I'd love to update to Swift 5 :)
@djbe I want to support #"..."# syntax for readability. However, you must also support versions below Swift 5. If I do, think the code will be less readable.
ex)
#if swift(<5.0)
self.format = format ?? Variable("\"yyyy-MM-dd 'at' HH:mm\"")
#else
self.format = format ?? Variable(#""yyyy-MM-dd 'at' HH:mm""#)
#endif
Is there more info about that SIL exception? Is it new in Swift 5? Radar?
Yeah, we won't be able to use raw strings until we drop 4.2 support 🤷♂️
@djbe Compile-time keywords(like #file) are expected to cause problems due to type inference errors during static dispatch.
Before: Throw SIL Exception (https://travis-ci.org/stencilproject/Stencil/jobs/508764850)
let path = Path(#file) + ".." + "fixtures" + "huge.html"
After:
let basePath: String = #file //< Specify type
let path = Path(basePath) + ".." + "fixtures" + "huge.html"
Would this work then?
let path = Path(#file as String) + ".." + "fixtures" + "huge.html"
This changed fixed PathKit https://github.com/kylef/PathKit/pull/69/files#diff-663087ac5b85edfc8e4ff1dd83b915abL12
Awesome! Thanks so much for your effort on this!
Mind tagging a release with Swift 5 support?