Is there a safe way to change the scope of a variable, without affecting the memory layout in an unsafe way?
For example, say I wanted to make the ERC721's _balances and _owners variables internal rather than private, so that an upgrade can make a more efficient batchMint.
If I try this directly by just re-declaring the variable in the child class as internal, OpenZeppelin's "assertStorageUpgradeSafe" throws "Deleted . Keep variable even if unused".
In my case, I'm not trying to delete it, just open up its accessibility
There is no way to change the scope of a variable from a child contract. Declaring a variable with the same name in a child contract will not overlap, and removing it from the parent is will change the layout.
You could modify the parent contract, change the scope there, and then use that in a child contract.