fix useless_access_modifier bug

This fixes the bug, adds the test case, as well as an additional one where def is used with an explicit constant.