Understand the mistake in solving the continuity problem

I have seen more than one answer about this question but I would like to understand why my first idea of solution is not right!
Let $$ \displaystyle f(x) = \begin{cases} x^2 \qquad x \in \mathbb{Q} \\ -x^2 \qquad x \in \mathbb{R} \setminus \mathbb{Q} \end{cases} $$ I want to prove that $f$ is continuous only in $x=0$. I know that in order to prove the function is not continuous in $x_0\neq 0$ I have to find two sequence $x_n\to x_0\in\mathbb{Q}$ with $f(x_n)\to l\neq x_0^2$ and $y_n\to x_0\in\mathbb{R} \setminus \mathbb{Q}$ with $f(y_n)\to t\neq -x_0^2$.

But my first idea was to consider that: $$\lim_{x\to x_0}f(x)=x_0^2\,\,\, \text{if}\,\, x_0\in\mathbb{Q}$$ $$\lim_{x\to x_0}f(x)=-x_0^2\,\,\, \text{if}\,\, x_0\in\mathbb{R} \setminus \mathbb{Q}$$ Then $x_0=-x_0^2\iff x_0=0$...but I think something is wrong...maybe this depends on the fact that I am considering an equality between a rational quantity ($x_0^2$) and a possible irrational one ($-x_0^2$).
Can you help me in understanding the mistake in this idea?


$$\lim_{x\to x_0}f(x)=x_0^2\,\,\, \text{if}\,\, x_0\in\mathbb{Q}$$ is not a correct statement. In fact, that limit here does not exist except when $x_0=0$.

The correct argument is as follows: Suppose $x_0 \neq 0$. There exists a sequence $(r_n)$ of rational numbers converging to $x_0$ and also a sequence $(t_n)$ of irrational numbers converging to $x_0$. Since $f(r_n)=r_n^{2}\to x_0^{2}$ and $f(t_n)=-t_n^{2}\to -x_0^{2} \neq x_0^{2}$ it follows that $$\lim_{x\to x_0}f(x)$$ does not exist. Hence, $f$ is not continuous at $x_0$.