Skip to content

Commit 079c83b

Browse files
committed
Reword message a bit more based on review feedback
1 parent 2a0c589 commit 079c83b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

stdlib/public/runtime/DynamicCast.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ static HeapObject * getNonNullSrcObject(OpaqueValue *srcValue,
126126

127127
std::string srcTypeName = nameForMetadata(srcType);
128128
std::string destTypeName = nameForMetadata(destType);
129-
const char * const msg = "Non-Optional value of type '%s' (%p)"
130-
" holds a null pointer?!"
129+
const char * const msg = "Found a null pointer in a value of type '%s' (%p)."
130+
" Non-Optional values are not allowed to hold null pointers."
131131
" (Detected while casting to '%s' (%p))%s\n";
132132
if (runtime::bincompat::useLegacyPermissiveObjCNullSemanticsInCasting()) {
133133
// In backwards compatibility mode, this code will warn and return the null

test/Casting/CastTraps.swift.gyb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,8 @@ CastTrapsTestSuite.test("${t1}__${t2}")
107107
protocol P2 {}
108108
if #available(SwiftStdlib 5.5, *) {
109109
CastTrapsTestSuite.test("Unexpected null")
110-
.crashOutputMatches("Non-Optional value of type '")
110+
.crashOutputMatches("Found a null pointer in a value of type '")
111111
.crashOutputMatches("Foo'")
112-
.crashOutputMatches("holds a null pointer")
113112
.crashOutputMatches("(Detected while casting to '")
114113
.crashOutputMatches("P2'")
115114
.code
@@ -128,8 +127,7 @@ CastTrapsTestSuite.test("Unexpected null")
128127
#if _runtime(_ObjC)
129128
if #available(SwiftStdlib 5.5, *) {
130129
CastTrapsTestSuite.test("Unexpected Obj-C null")
131-
.crashOutputMatches("Non-Optional value of type 'NSObject'")
132-
.crashOutputMatches("holds a null pointer")
130+
.crashOutputMatches("Found a null pointer in a value of type 'NSObject'")
133131
.crashOutputMatches("(Detected while casting to '")
134132
.crashOutputMatches("P2'")
135133
.code

0 commit comments

Comments
 (0)