Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Winter '21 Salesforce Safe Navigation Operator Bugs
// Example: CompileFail error on valid code
class B {
string field = 'Test';
}
B b1 = new B(), b2;
//System.TypeException: Comparison arguments must be compatible types: String, Boolean
System.assertEquals(true, b1.field != b2?.field);
// Example: Internal Server Error, no gack code
Contact con1, con;
System.assert(con1?.FirstName == con2?.FirstName);
// Example: debug outputs opposite value
class A {
string field = 'Test';
}
A a1 = new A(), a2;
System.debug(a1.field != a2?.field); // Outputs false, should be true
System.debug(a1.field == a2?.field); // Outputs true, should be false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.