I know that the writers of the characters probably didn't intend these characters to be autistic. Autism wasn't even known in Doyle's time.
As with Sheldon, it seems to me that this does not mean that the character does not have autism, or is not intended to have autism. Someone who is extremely ignorant of cars might still include a car in a novel, and be unaware that the car needs a battery. The author may not include a battery in his concept of a car, however this does not mean that he has written about an advanced car which somehow obviates the need for a battery, those of us who do know this much about cars may assume that the battery is indeed there, whether directly intended by the author or not.
If Doyle knew a person who would today be recognized as having Asperger's and used those aspie traits that would be beneficial to an investigator to build his character with, it follows that he did intentionally make Holmes an aspie whether he was aware of the label or not. His personality is no accident.
I really like this explanation with the car,
@MrSpock.
I think it can be applied to Sherlock Holmes as well.
Doyle might not have known that the battery was the feature he described in his car that made it so beneficial for his stories, but he included the useful "effects" of the battery (what he could see, i. e. the aspie traits he saw in the person(s) he based Sherlock Holmes on) anyway.
So the personality wasn't an accident because he knew the effects and what he saw, but I don't think that he actually intended to write about a battery, no matter whether he knew the term or not. He probably only had some vague general ideas about this in my opinion. He picked the effects and traits he needed for his stories and some of them happened to be the beneficial aspie traits.
Another interesting point about this is that later people can say "Of course he wrote about a battery!" (autism) and even mention this in their version of the canon.
Applied to Sherlock Holmes this is basically possible when two conditions are fulfilled:
1. The adaption is produced nowadays (or not too long ago) when autism is recognized and rather well-known.
2. The adaption takes place in modern times as well, so there is no anachronism in the adaption itself.
For example, there are quite literal hints about Sherlock being autistic in both
Sherlock (episode
The Hounds of Baskerville) and
Elementary (episode
Murder Ex Machina (though this might be up to one's interpretation of Fiona's statement regarding Sherlock's neurotype when she says "I'm not sure what you are.", i. e. neurotypical or neuroatypical)).
Both conditions are fulfilled for these shows.
However, they can't do anything like this in the movies with Robert Downey Jr., for example, as they take place in the Victorian canon era. In this case you might work with your knowledge of autism and maybe include it in the characterization, but of course you can't say that he is autistic in the movie iteself despite possibly knowing about it or interpreting the character like this as an author.