Here are two sentences patterns:
Have you ever been to the opera when you lived in Milan?
Did you ever go to the opera when you lived in Milan?
What is the difference between them? How can we say, which is right sentence?
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It only takes a minute to sign up.Sign up to join this community
I should start by admitting that although I can describe a usage distinction between Did you [verb] when [context]? and Have you [verbed] when [context]?, I can't explain exactly why it applies.
1: Did you ever go to the opera when you were a drunk?
2: Have you ever been to the opera when you were drunk?
...where #1 probably refers to a single past timeframe (during which you had alcohol abuse issues), but #2 simply restricts the scope of the question to the co-occurrence of two past activities (being at the opera, and being drunk), either or both of which may never have occurred. Since I don't think the word ever makes any real difference, I'll also throw in...
3: Did you cry when you were a baby?
4: Did you cry as a baby?
5: ? Have you cried when you were a baby?
6: ? Have you cried as a baby?
...where the when/as-clauses are similar to #1 above - during a specific period which definitely occurred in the past, and won't occur again now or in the future. And to my ear, whereas the "did" construction also works in context #2 (at the same time as doing something/being in a specific state), the "have" version doesn't. Which is why I've marked #5, #6 as "questionable" forms.
It seems to me Have you [past participle]? is a present perfect form, which means it should imply some relevance to current time (of utterance). So perhaps the reason I can't endorse the last two examples above is simply because the specified past time period can't possibly occur again.