Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix duplicated semantic token for decorators which caused them to not get highlighted as decorators in neovim #925

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

DetachHead
Copy link
Owner

fixes #278

This comment has been minimized.

@DetachHead DetachHead force-pushed the fix-decorator-semantic-highlighting branch from 7445306 to a921e77 Compare December 5, 2024 09:24
@DetachHead DetachHead force-pushed the fix-decorator-semantic-highlighting branch from a921e77 to 1f2cee4 Compare December 5, 2024 10:02
Copy link
Contributor

github-actions bot commented Dec 5, 2024

Diff from mypy_primer, showing the effect of this PR on open source code:

sympy (https://github.com/sympy/sympy)
-     Type of "rootof" is "(f: Unknown, x: Unknown, index: Unknown | None = None, radicals: bool = True, expand: bool = True) -> (Unknown | One | NegativeOne | Zero | Integer | Rational | NaN | ComplexInfinity | Half | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr)" (reportUnknownVariableType)
+     Type of "rootof" is "(f: Unknown, x: Unknown, index: Unknown | None = None, radicals: bool = True, expand: bool = True) -> (Unknown | One | NegativeOne | Zero | Integer | Rational | NaN | ComplexInfinity | Half | Expr)" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_inequalities.py:134:9 - warning: Type of "inf" is partially unknown
+     Type of "inf" is "One | NegativeOne | Zero | Integer | Rational | NaN | ComplexInfinity | Half | Unknown" (reportUnknownVariableType)
-     Type of "r" is "Unknown | One | NegativeOne | Zero | Integer | Rational | NaN | ComplexInfinity | Half | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr" (reportUnknownVariableType)
+     Type of "r" is "Unknown | One | NegativeOne | Zero | Integer | Rational | NaN | ComplexInfinity | Half | Expr" (reportUnknownVariableType)
-     Type of "factor" is "(f: Unknown, ..., deep: bool = False) -> (Unknown | Add | Order | Mul)" (reportUnknownVariableType)
+     Type of "factor" is "(f: Unknown, ..., deep: bool = False) -> (Unknown | Add | Order | Mul | Expr)" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_recurr.py:116:5 - warning: Type of "h" is partially unknown
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_recurr.py:116:5 - warning: Type of "h" is unknown (reportUnknownVariableType)
-     Type of "h" is "Any | Unknown" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:104:9 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any | bool], Any]", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:104:9 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any], Any]", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:105:13 - warning: Return type, "Integer | Unknown | NaN | Expr | One | NegativeOne | Zero | Rational | ComplexInfinity | Half", is partially unknown (reportUnknownParameterType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:109:20 - warning: Return type, "Unknown | NaN | Expr | One | NegativeOne | Zero | Integer | Rational | ComplexInfinity | Half", is partially unknown (reportUnknownVariableType)
-     Type of "constraints" is "list[_NotImplementedType | Unknown | Any | bool]" (reportUnknownVariableType)
+     Type of "constraints" is "list[_NotImplementedType | Unknown | Any]" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:111:29 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iterable" in function "sum"
+     Argument type is "Generator[Any | Unknown, None, None]" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:113:25 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iterable" in function "sum"
+     Argument type is "Generator[Any | Unknown, None, None]" (reportUnknownArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:114:16 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any | bool], Any]", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:114:16 - warning: Return type, "tuple[int, list[_NotImplementedType | Unknown | Any], Any]", is partially unknown (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:181:5 - warning: Type of "ans" is partially unknown
+     Type of "ans" is "tuple[Unknown, list[int | Unknown]]" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:221:9 - warning: Type of "ans" is partially unknown
+     Type of "ans" is "tuple[Unknown, list[int | Unknown]]" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:222:48 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iterable" in function "__init__"
+     Argument type is "zip[tuple[Any, int | Unknown]]" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:222:55 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iter2" in function "__new__"
+     Argument type is "list[int | Unknown]" (reportUnknownArgumentType)
-     Type of "ans" is "tuple[Expr | Rational | NaN | ComplexInfinity | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | Number | Unknown | Order | int, list[int | ComplexInfinity | Rational | NaN | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr]]" (reportUnknownVariableType)
+     Type of "ans" is "tuple[Unknown, list[int | Unknown]]" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:230:53 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iterable" in function "__init__"
+     Argument type is "zip[tuple[Any, int | Unknown]]" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:230:60 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iter2" in function "__new__"
+     Argument type is "list[int | Unknown]" (reportUnknownArgumentType)
-     Type of "ans" is "tuple[Expr | Rational | NaN | ComplexInfinity | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | Number | Unknown | Order | int, list[int | ComplexInfinity | Rational | NaN | One | NegativeOne | Zero | Integer | Half | Infinity | NegativeInfinity | Float | _NotImplementedType | Expr]]" (reportUnknownVariableType)
+     Type of "ans" is "tuple[Unknown, list[int | Unknown]]" (reportUnknownVariableType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:236:53 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iterable" in function "__init__"
+     Argument type is "zip[tuple[Any, int | Unknown]]" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_simplex.py:236:60 - warning: Argument type is partially unknown
+     Argument corresponds to parameter "iter2" in function "__new__"
+     Argument type is "list[int | Unknown]" (reportUnknownArgumentType)
-     Type of "n" is "Unknown | Overload[(n: int = 15, subs: dict[Basic, Basic | float] | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: str | None = None, verbose: bool = False) -> Expr, (n: int = 15, subs: dict[Basic, Basic | float] | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: str | None = None, verbose: bool = False) -> Basic] | Any" (reportUnknownMemberType)
+     Type of "n" is "Unknown | Overload[(n: int = 15, subs: dict[Basic, Basic | float] | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: str | None = None, verbose: bool = False) -> Expr, (n: int = 15, subs: dict[Basic, Basic | float] | None = None, maxn: int = 100, chop: bool = False, strict: bool = False, quad: str | None = None, verbose: bool = False) -> Basic]" (reportUnknownMemberType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solvers.py:479:5 - warning: Type of "sol" is partially unknown
+     Type of "sol" is "dict[Any, Unknown]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solvers.py:1385:13 - warning: Argument type is Any
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solvers.py:1385:13 - warning: Argument type is unknown
-     Argument corresponds to parameter "lhs" in function "__new__" (reportAny)
+     Argument corresponds to parameter "lhs" in function "__new__" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solvers.py:1385:41 - warning: Argument type is unknown
+     Argument corresponds to parameter "rhs" in function "__new__" (reportUnknownArgumentType)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solvers.py:1563:5 - warning: Type of "answer" is partially unknown
+     Type of "answer" is "list[dict[Any, int] | dict[Any, int | Any | Unknown]]" (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solvers.py:2498:23 - warning: Argument type is Any
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solvers.py:2498:23 - warning: Argument type is unknown
-     Argument corresponds to parameter "args" in function "__new__" (reportAny)
+     Argument corresponds to parameter "args" in function "__new__" (reportUnknownArgumentType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solvers.py:2507:5 - warning: Type of "eq" is Any (reportAny)
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solvers.py:2507:5 - warning: Type of "eq" is unknown (reportUnknownVariableType)
-   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solvers.py:2508:18 - warning: Argument type is Any
+   /tmp/mypy_primer/projects/sympy/sympy/solvers/tests/test_solvers.py:2508:18 - warning: Argument type is unknown
-     Argument corresponds to parameter "eq" in function "unrad" (reportAny)
+     Argument corresponds to parameter "eq" in function "unrad" (reportUnknownArgumentType)

... (truncated 4334 lines) ...

spack (https://github.com/spack/spack)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/requirements.test/packages/x/package.py:15:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/requirements.test/packages/x/package.py:15:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/requirements.test/packages/x/package.py:16:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/requirements.test/packages/x/package.py:16:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/requirements.test/packages/y/package.py:15:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/requirements.test/packages/y/package.py:15:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:27:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:27:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:28:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:28:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:29:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:29:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:30:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:30:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:31:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:31:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:32:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/armadillo/package.py:32:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/elpa/package.py:27:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/elpa/package.py:27:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/elpa/package.py:28:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/elpa/package.py:28:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/elpa/package.py:29:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/elpa/package.py:29:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/elpa/package.py:30:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/elpa/package.py:30:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/hdf5/package.py:99:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/hdf5/package.py:99:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/hdf5/package.py:101:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/hdf5/package.py:101:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/hdf5/package.py:102:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/hdf5/package.py:102:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/hdf5/package.py:105:9 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/hdf5/package.py:105:9 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/hdf5/package.py:106:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/hdf5/package.py:106:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
-   /tmp/mypy_primer/projects/spack/var/spack/repos/tutorial/packages/hdf5/package.py:107:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)

... (truncated 13 lines) ...

comtypes (https://github.com/enthought/comtypes): 261.87x slower (0.1s -> 22.8s in a single noisy sample)

@DetachHead DetachHead merged commit fd05d52 into main Dec 5, 2024
20 checks passed
@DetachHead DetachHead deleted the fix-decorator-semantic-highlighting branch December 5, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add typemod for decorators
1 participant