Skip to content

Commit

Permalink
fix(language_server): remove reliance on * unpacking within types
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNuclearNexus committed Jan 30, 2025
1 parent 1463ad6 commit 33a2535
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions language_server/server/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import inspect
import logging
import types
from typing import Any, Generic, Optional, TypeVar, Union, cast, get_origin
from typing import Any, Generic, Optional, TypeVar, Union, Unpack, cast, get_origin
import typing

from beet.core.utils import extra_field
Expand Down Expand Up @@ -44,14 +44,17 @@

def node_to_types(node: AstNode):

nodes = []
types = []
for n in node.walk():
if isinstance(n, AstExpressionBinary) and n.operator == "|":
continue

nodes.append(n)
annotation = expression_to_annotation(n)

return Union[*nodes]
if annotation is not UNKNOWN_TYPE:
types.append(annotation)

return Union[Unpack[types]]


@dataclass(frozen=True, slots=True)
Expand Down

0 comments on commit 33a2535

Please sign in to comment.