..Data should be programmed understand the subtleties of consent, right? It was clear to me that Data was under the impression it was a fully consenting invitation.
Yes, I mean, I recall Data's "mother" seeing him going to visit Troi in that one episode, and she gets the wrong impression that his sexuality program is working (of course, DAta's intent in visiting her was nothing like that though). I imagine that would include things like consent, not just the capacity to perform the act itself.
I thought the episode was implying that Tasha was *already* secretly attracted to Data, that's why she chose him. As for Data's immaturity, yeah, but he's not going to have the same emotional response to sex as a human and I think in this case it's perfectly ok to think of him as an adult male, if this is implying that Yar took advantage of him. I don't think Data could take advantage of Yar because he really didn't seem interested in having sex with the women he's around, she initiated, I think he was just going along with what he thought she wanted.
And as for Tash'a saying "It never happened!" I think that's more that she was embarrassed by acting strangely while intoxicatd, not that she was overly horrified at the idea of having sex with Data. It's been a while since I watched that ep, though, can't recall too many details.
Tasha's advice of "It never happened" is good. For the whole episode.
This. So much.