Implement isDefaultValueConstant and fix getDefaultValueConstantName

Closes #3812
Closes #3828.