Unexpected behaviour with zero symbol in MeasurementFormatter

Number:rdar://FB7685455 Date Originated:05/02/20
Status:Open Resolved:
Product:Foundation Product Version:
Classification:Incorrect/Unexpected Behavior Reproducible:always
I'm experiencing unexpected behavior when declaring a zero symbol in a MeasurementFormatter. There is a difference wether the measurement is using Generics or not:

var distance = Measurement<UnitLength>(value: 0, unit: .parsecs) // output: '0 pc'
var distance2 = Measurement(value: 0, unit: Unit(symbol: UnitLength.parsecs.symbol)) // output '? pc' as expected

Please find a Playground attached, showing this issue in full code.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!