Skip to content

Commit b454e8d

Browse files
committed
Make emoji properties Darwin only.
Ubuntu 16.04 doesn't have a recent enough ICU to support these; we need a better long-term solution, such as bundling ICU with the toolchain.
1 parent d0e93ac commit b454e8d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

stdlib/public/core/UnicodeScalarProperties.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,12 @@ extension Unicode.Scalar.Properties {
581581
return _hasBinaryProperty(__swift_stdlib_UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED)
582582
}
583583

584+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
585+
// FIXME: These properties were introduced in ICU 57, but Ubuntu 16.04 comes
586+
// with ICU 55 so the values won't be correct there. Exclude them on
587+
// non-Darwin platforms for now; bundling ICU with the toolchain would resolve
588+
// this and other inconsistencies (https://bugs.swift.org/browse/SR-6076).
589+
584590
/// A Boolean property indicating whether the scalar has an emoji
585591
/// presentation, whether or not it is the default.
586592
///
@@ -656,6 +662,7 @@ extension Unicode.Scalar.Properties {
656662
public var isEmojiModifierBase: Bool {
657663
return _hasBinaryProperty(__swift_stdlib_UCHAR_EMOJI_MODIFIER_BASE)
658664
}
665+
#endif
659666
}
660667

661668
/// Case mapping properties.

test/stdlib/UnicodeScalarPropertiesTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ UnicodeScalarPropertiesTests.test("properties.booleanProperties") {
8181
expectBooleanProperty(\.changesWhenCaseFolded, trueFor: "A", falseFor: "!")
8282
expectBooleanProperty(\.changesWhenCaseMapped, trueFor: "A", falseFor: "!")
8383
expectBooleanProperty(\.changesWhenNFKCCaseFolded, trueFor: "A", falseFor: "!")
84+
85+
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
8486
// U+2708 AIRPLANE
8587
expectBooleanProperty(\.isEmoji, trueFor: "\u{2708}", falseFor: "A")
8688
// U+231A WATCH
@@ -89,6 +91,7 @@ UnicodeScalarPropertiesTests.test("properties.booleanProperties") {
8991
expectBooleanProperty(\.isEmojiModifier, trueFor: "\u{1F3FD}", falseFor: "A")
9092
// U+270B RAISED HAND
9193
expectBooleanProperty(\.isEmojiModifierBase, trueFor: "\u{270B}", falseFor: "A")
94+
#endif
9295
}
9396

9497
UnicodeScalarPropertiesTests.test("properties.lowercaseMapping") {

0 commit comments

Comments
 (0)