Modal verbs (can, must, may, might, should, etc.) in the present tense express possibility,
permission, obligation, or assumption.
When we want to refer to them in the past, we usually use special forms with have + past participle.:
modal verb +have+past participle.
needen’t+have+ past participle
She needn’t have bought that expensive raspberry cake.