diff --git a/clang/docs/ObjectiveCLiterals.html b/clang/docs/ObjectiveCLiterals.html
index 277e6136913c..2e533faf8ac0 100644
--- a/clang/docs/ObjectiveCLiterals.html
+++ b/clang/docs/ObjectiveCLiterals.html
@@ -120,11 +120,11 @@ NSDictionary *dictionary = @{
};
-This creates an NSDictionary
with 3 key/value pairs. Value sub-expressions of a dictionary literal must be Objective-C object pointer typed, as in array literals. Key sub-expresions must be of an Objective-C object pointer type that implements the <NSCopying>
protocol.
+This creates an NSDictionary
with 3 key/value pairs. Value sub-expressions of a dictionary literal must be Objective-C object pointer typed, as in array literals. Key sub-expressions must be of an Objective-C object pointer type that implements the <NSCopying>
protocol.
+Neither keys nor values can have the value nil
in containers. If the compiler can prove that a key or value is nil
at compile time, then a warning will be emitted. Otherwise, a runtime error will occur.
Using array and dictionary literals is safer than the variadic creation forms commonly in use today. Array literal expressions expand to calls to +[NSArray arrayWithObjects:count:]
, which validates that all objects are non-nil
. The variadic form, +[NSArray arrayWithObjects:]
uses nil
as an argument list terminator, which can lead to malformed array objects. Dictionary literals are similarly created with +[NSDictionary dictionaryWithObjects:forKeys:count:]
which validates all objects and keys, unlike +[NSDictionary dictionaryWithObjectsAndKeys:]
which also uses a nil
parameter as an argument list terminator.