A cast statement wrapped inside of parenthesis are being "unwrapped". If that was used to force order of operations so I could interacted with the casted type then that is broken and the Apex class becomes invalid.
Example:
public class Me {
{
Account a = new Account(NumberOfEmployees = 7);
Object objA = a;
Integer totalRecords = ((Account) objA).NumberOfEmployees;
}
}
A cast statement wrapped inside of parenthesis are being "unwrapped". If that was used to force order of operations so I could interacted with the casted type then that is broken and the Apex class becomes invalid.
Example:
Parse tree:
Formatted:
New Parse Tree:
You can see the scope of the cast_expression is promoted to the entire expression instead of being isolated as expected.