Add support for embedded Swift mode#494
Conversation
lorentey
left a comment
There was a problem hiding this comment.
Looks good, with the nit noted below -- I think we should just #if out all Custom[Debug]StringConvertible conformances, like we do mirrors and serialization
| } | ||
| #if !$Embedded | ||
| debugPrint(item, terminator: "", to: &result) | ||
| #endif |
There was a problem hiding this comment.
Hm, this replaces [1, 2, 3] with [, , ] in description properties, and that's not very nice.
In this case, the stdlib is currently substituting a generic message for each item, like this:
| #endif | |
| #else | |
| result += "(unprintable)" | |
| #endif |
This results in [(unprintable), (unprintable), (unprintable)]. To be fair, that isn't that useful, either. I think it would be preferable to just replace the entire body with a short summary like "[\(count) values]". We can also choose to entirely omit the CustomStringConvertible conformances under $Embedded.
(Ditto for _dictionaryDescription and all other collection printing code below.)
There was a problem hiding this comment.
This turns out to be a good idea because the LosslessStringConvertible conformance also relied on description.
|
@parkera non-blocking question… do we have build jobs for embedded mode? |
Remove calls to `debugPrint` (which does not exist), and ifdef out support for `Codable` and `Reflection`.
e07dc96 to
c883a17
Compare
I'm not sure if we have integrated embedded support into the GitHub actions - Swift CI is certainly building toolchains though. cc @shahmishal |
|
@parkera thanks for taking such a quick move on this, I'll try to figure out a common CI solution for the swiftlang repos next week, so we can merge this with confidence of it not breaking in the future. |
|
@swift-ci test |
Remove calls to
debugPrint(which does not exist), and ifdef out support forCodableandReflection.Note that testing is not available in embedded yet, as far as I know.