Repository: sympy/sympy

Issue:
Wrong result with solveset
```
>>> from sympy import *
>>> x = Symbol('x')
>>> solveset(x**2 - 2*x - 15, symbol = x, domain = Interval(-oo, 0))
EmptySet()
```
This is incorrect. The correct output for the above code should be `FiniteSet(-3)`. When the `domain = S.Reals`, `FiniteSet(-3, 5)` is returned.


Discussion:

Patch:
diff --git a/sympy/solvers/solveset.py b/sympy/solvers/solveset.py
index 885918210d..59b60b2e47 100644
--- a/sympy/solvers/solveset.py
+++ b/sympy/solvers/solveset.py
@@ -105,7 +105,7 @@ def _invert(f_x, y, x, domain=S.Complexes):
     else:
         x1, s = _invert_complex(f_x, FiniteSet(y), x)
 
-    if not isinstance(s, FiniteSet) or x1 == f_x:
+    if not isinstance(s, FiniteSet) or x1 == f_x or x1 != x:
         return x1, s
 
     return x1, s.intersection(domain)


Test patch:
diff --git a/sympy/solvers/tests/test_solveset.py b/sympy/solvers/tests/test_solveset.py
index b84df55e3c..a4527e63ad 100644
--- a/sympy/solvers/tests/test_solveset.py
+++ b/sympy/solvers/tests/test_solveset.py
@@ -1633,3 +1633,6 @@ def test__is_finite_with_finite_vars():
     assert all(f(1/x) is None for x in (
         Dummy(), Dummy(real=True), Dummy(complex=True)))
     assert f(1/Dummy(real=False)) is True  # b/c it's finite but not 0
+
+def test_issue_13550():
+    assert solveset(x**2 - 2*x - 15, symbol = x, domain = Interval(-oo, 0)) == FiniteSet(-3)