IMO, if they pass you then turn right soon enough to make you hit your brakes, they're in the wrong. I don't know about the law, that's just my opinion.
It doesn't happen much to me, but for some reason it happened to me twice in one ride last week; car passed me, then signalled a right turn. I think they saw me and realized they'd be hitting me if they turned, so they were waiting, but I wasn't going to bet my life that I was reading them right, so I braked, cut behind them and passed them on the left.
__________________
Work: the 8 hours that separates bike rides.