diff --git a/mypy/plugins/dataclasses.py b/mypy/plugins/dataclasses.py
--- a/mypy/plugins/dataclasses.py
+++ b/mypy/plugins/dataclasses.py
@@ -221,9 +221,12 @@ def add_slots(self,
                 self._ctx.reason,
             )
             return
-        if info.slots is not None or info.names.get('__slots__'):
+
+        generated_slots = {attr.name for attr in attributes}
+        if ((info.slots is not None and info.slots != generated_slots)
+                or info.names.get('__slots__')):
             # This means we have a slots conflict.
-            # Class explicitly specifies `__slots__` field.
+            # Class explicitly specifies a different `__slots__` field.
             # And `@dataclass(slots=True)` is used.
             # In runtime this raises a type error.
             self._ctx.api.fail(
@@ -234,7 +237,7 @@ def add_slots(self,
             )
             return
 
-        info.slots = {attr.name for attr in attributes}
+        info.slots = generated_slots
 
     def reset_init_only_vars(self, info: TypeInfo, attributes: List[DataclassAttribute]) -> None:
         """Remove init-only vars from the class and reset init var declarations."""

diff --git a/test-data/unit/check-dataclasses.test b/test-data/unit/check-dataclasses.test
--- a/test-data/unit/check-dataclasses.test
+++ b/test-data/unit/check-dataclasses.test
@@ -1456,3 +1456,69 @@ class Other:
     __slots__ = ('x',)
     x: int
 [builtins fixtures/dataclasses.pyi]
+
+
+[case testSlotsDefinitionWithTwoPasses1]
+# flags: --python-version 3.10
+# https://github.com/python/mypy/issues/11821
+from typing import TypeVar, Protocol, Generic
+from dataclasses import dataclass
+
+C = TypeVar("C", bound="Comparable")
+
+class Comparable(Protocol):
+    pass
+
+V = TypeVar("V", bound=Comparable)
+
+@dataclass(slots=True)
+class Node(Generic[V]):  # Error was here
+    data: V
+[builtins fixtures/dataclasses.pyi]
+
+[case testSlotsDefinitionWithTwoPasses2]
+# flags: --python-version 3.10
+from typing import TypeVar, Protocol, Generic
+from dataclasses import dataclass
+
+C = TypeVar("C", bound="Comparable")
+
+class Comparable(Protocol):
+    pass
+
+V = TypeVar("V", bound=Comparable)
+
+@dataclass(slots=True)  # Explicit slots are still not ok:
+class Node(Generic[V]):  # E: "Node" both defines "__slots__" and is used with "slots=True"
+    __slots__ = ('data',)
+    data: V
+[builtins fixtures/dataclasses.pyi]
+
+[case testSlotsDefinitionWithTwoPasses3]
+# flags: --python-version 3.10
+from typing import TypeVar, Protocol, Generic
+from dataclasses import dataclass
+
+C = TypeVar("C", bound="Comparable")
+
+class Comparable(Protocol):
+    pass
+
+V = TypeVar("V", bound=Comparable)
+
+@dataclass(slots=True)  # Explicit slots are still not ok, even empty ones:
+class Node(Generic[V]):  # E: "Node" both defines "__slots__" and is used with "slots=True"
+    __slots__ = ()
+    data: V
+[builtins fixtures/dataclasses.pyi]
+
+[case testSlotsDefinitionWithTwoPasses4]
+# flags: --python-version 3.10
+import dataclasses as dtc
+
+PublishedMessagesVar = dict[int, 'PublishedMessages']
+
+@dtc.dataclass(frozen=True, slots=True)
+class PublishedMessages:
+    left: int
+[builtins fixtures/dataclasses.pyi]

Regression in 0.930 - Slots 
**Bug Report**

This error is incorrectly showing up on my class that inherits from Generic[V]. This is probably because it inherits from Protocol, which defines `__slots__ = ()`
error: "Node" both defines "__slots__" and is used with "slots=True"  [misc]

**To Reproduce**

```

C = TypeVar("C", bound="Comparable")

class Comparable(Protocol):
    @abstractmethod
    def __eq__(self, other: Any) -> bool:
        pass

    @abstractmethod
    def __lt__(self: C, other: C) -> bool:
        pass

    def __gt__(self: C, other: C) -> bool:
        return (not self < other) and self != other

    def __le__(self: C, other: C) -> bool:
        return self < other or self == other

    def __ge__(self: C, other: C) -> bool:
        return not self < other


V = TypeVar("V", bound=Comparable)

@dataclass(slots=True)
class Node(Generic[V]):
    data: V
```

**Expected Behavior**

This should not cause an error.

**Actual Behavior**
error: "Node" both defines "__slots__" and is used with "slots=True"  [misc]

**Your Environment**

- Mypy version used: 0.930
- Mypy command-line flags: --strict
- Mypy configuration options from `mypy.ini` (and other config files):
- Python version used: 3.10
- Operating system and version: Mac OS


This happens because `semanal` requires two passes and we already set `__slots__` during the first pass. Fix is incomming.
mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesCustomInit mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBasic mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBasicInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDeepInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOverridingWithDefaults mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesMultipleInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOverriding mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDeepInitVarInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesMultiInit mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesFreezing mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesBadInit mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesFields mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultFactoryTypeChecking mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaults mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultFactories mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesMultiInitDefaults mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyOnFieldFalse mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultOrdering mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnly mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyOnField mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyWithSentinel mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesClassmethods mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassOrderingWithoutEquality mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassUntypedGenericInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyWithSentinelAndFieldOverride mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassOrderingWithCustomMethods mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOverloadsAndClassmethods mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericSubtype mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyWithSentinelAndSubclass mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesClassVars mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassDefaultsInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesOrderingKwOnlyWithMultipleSentinel mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassMultiGenericInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenerics mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassOrdering mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassGenericsClassmethod mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testNoComplainFieldNone mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVarNoOverride mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesNoInitInitVarInheritance mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesForwardRefs mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testNoComplainFieldNoneStrict mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFactory mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVarPostInitOverride mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVars mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDisallowUntypedWorksForward mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVarOverride mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDisallowUntypedWorksForwardBad mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVarsAndDefer mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassOrderingDeferred mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInitVarIncremental mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDeferredDataclassInitSignature mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFieldDeferred mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testMemberExprWorksAsField mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFieldDeferredFrozen mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDeferredDataclassInitSignatureSubclass mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultsMroOtherFile mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesDefaultsIncremental mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testTypeInDataclassDeferredStar mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassInheritanceNoAnnotation2 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassInheritanceNoAnnotation mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassesInheritingDuplicateField mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassHasAttributeWithFields mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassCallableAssignment mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassCallableProperty mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassCallablePropertyWrongType mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassCallablePropertyWrongTypeAssignment mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFieldDoesNotFailOnKwargsUnpacking mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFieldWithPositionalArguments mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassFieldWithTypedDictUnpacking mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassWithSlotsArg mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassWithSlotsDef mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassWithSlotsConflict mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testDataclassWithSlotsArgBefore310 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testSlotsDefinitionWithTwoPasses2 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testSlotsDefinitionWithTwoPasses3
mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testSlotsDefinitionWithTwoPasses1 mypy/test/testcheck.py::TypeCheckSuite::check-dataclasses.test::testSlotsDefinitionWithTwoPasses4