(two planes with merged vertices)
It's a normals orientation issue. First, check your normals by enabling the Normals Overlay:
- blue normals are pointing outside
- red normals are pointing inside
The shading error comes from Blender not knowing how to get from one orientation to the other any more. Fix the normals by re-calculating them (this will make the orientation consistent across the model) in Edit Mode:
Select all of the mesh A in edit mode and press CtrlShiftN. This will recalculate the normals.