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

intersections become never #530

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

@KotlinIsland KotlinIsland self-assigned this Oct 9, 2023
@KotlinIsland KotlinIsland marked this pull request as draft October 9, 2023 14:47
@github-actions

This comment has been minimized.

@KotlinIsland KotlinIsland force-pushed the feat/intersection-never branch from 5beceb5 to a478ca1 Compare October 10, 2023 07:12
@github-actions

This comment has been minimized.

@KotlinIsland KotlinIsland force-pushed the master branch 3 times, most recently from 00d22ec to bc4ea04 Compare October 16, 2023 01:42
@KotlinIsland KotlinIsland force-pushed the master branch 5 times, most recently from 7d90d82 to feefbbd Compare October 31, 2023 05:17
@KotlinIsland KotlinIsland force-pushed the feat/intersection-never branch from a478ca1 to 324e7ac Compare November 15, 2023 22:49
Copy link

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

jax (https://github.com/google/jax)
- jax/_src/array.py:768:19: error: Intersection of "slice & int" cannot exist: would have incompatible method signatures  [unreachable]
+ jax/_src/api.py:856:16: error: "Never" not callable  [misc]
- jax/_src/api.py:856:16: error: Expression has type "Untyped"  [no-any-expr]
- jax/_src/api.py:856:16: error: Expression has type "Any (from omitted generics)"  [no-any-expr]
- jax/_src/api.py:856:51: error: Call to incomplete function "_std_basis" in typed context  [no-untyped-call]
- jax/_src/api.py:856:51: error: "_std_basis" does not return a value  [func-returns-value]
- jax/_src/api.py:856:51: note: Type is "def (pytree: Untyped) -> None"
- jax/_src/api.py:856:62: error: Cannot determine type of "dyn_args"  [has-type]
- jax/_src/api.py:860:64: error: Expression has type "Any (from omitted generics)"  [no-any-expr]
+ jax/_src/api.py:864:7: error: Statement is unreachable  [unreachable]
- jax/_src/api.py:862:65: error: Expression has type "Any (from omitted generics)"  [no-any-expr]
- jax/_src/api.py:862:68: error: Expression has type "Any (from omitted generics)"  [no-any-expr]
- jax/_src/api.py:864:7: error: Returning Any from function declared to return "None"  [no-any-return]
- jax/_src/api.py:864:14: error: Expression has type "Any"  [no-any-expr]

scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/model_selection/_search.py:760:39: error: Intersection of "bool & str" cannot exist: would have incompatible method signatures  [unreachable]

sympy (https://github.com/sympy/sympy)
- sympy/matrices/reductions.py:166:16: error: Expression type contains "Any" (has type "bool & FunctionType | (expr: Untyped) -> None")  [no-any-expr]
+ sympy/matrices/reductions.py:166:16: error: Expression type contains "Any" (has type "(expr: Untyped) -> None")  [no-any-expr]
+ sympy/matrices/reductions.py:166:28: error: If condition is always false  [redundant-expr]
- sympy/matrices/reductions.py:168:49: error: Expression type contains "Any" (has type "bool & FunctionType | (expr: Untyped) -> None")  [no-any-expr]
+ sympy/matrices/reductions.py:168:49: error: Expression type contains "Any" (has type "(expr: Untyped) -> None")  [no-any-expr]
- sympy/matrices/reductions.py:214:16: error: Expression type contains "Any" (has type "bool & FunctionType | (expr: Untyped) -> None")  [no-any-expr]
+ sympy/matrices/reductions.py:214:16: error: Expression type contains "Any" (has type "(expr: Untyped) -> None")  [no-any-expr]
+ sympy/matrices/reductions.py:214:28: error: If condition is always false  [redundant-expr]
- sympy/matrices/reductions.py:242:49: error: Expression type contains "Any" (has type "bool & FunctionType | (expr: Untyped) -> None")  [no-any-expr]
+ sympy/matrices/reductions.py:242:49: error: Expression type contains "Any" (has type "(expr: Untyped) -> None")  [no-any-expr]
- sympy/matrices/reductions.py:379:24: error: Incompatible types in assignment (expression has type "(expr: Untyped) -> None", variable has type "bool & FunctionType")  [assignment]
+ sympy/matrices/reductions.py:377:13: error: Statement is unreachable  [unreachable]
+ sympy/matrices/reductions.py:379:24: error: Expression type contains "Any" (has type "(expr: Untyped) -> None")  [no-any-expr]
+ sympy/matrices/reductions.py:381:57: error: Expression type contains "Any" (has type "(expr: Untyped) -> None")  [no-any-expr]
+ sympy/matrices/eigen.py:206:13: error: Statement is unreachable  [unreachable]
- sympy/matrices/eigen.py:206:13: error: Usage of untyped name "charpoly" in typed context  [no-untyped-usage]
- sympy/matrices/eigen.py:206:24: error: Expression has type "Untyped"  [no-any-expr]
+ sympy/matrices/eigen.py:247:13: error: Statement is unreachable  [unreachable]
- sympy/matrices/eigen.py:247:13: error: Usage of untyped name "charpoly" in typed context  [no-untyped-usage]
- sympy/matrices/eigen.py:247:24: error: Expression has type "Untyped"  [no-any-expr]

manticore (https://github.com/trailofbits/manticore)
- manticore/platforms/evm.py:3340:41: error: Incompatible types in assignment (expression has type "(Any, Any, Any, Any, Any, Any, Any, bool & None)", variable has type "None")  [assignment]
+ manticore/platforms/evm.py:3340:41: error: Incompatible types in assignment (expression has type "(Any, Any, Any, Any, Any, Any, Any, Never)", variable has type "None")  [assignment]
- manticore/platforms/evm.py:3376:9: error: No return value expected  [return-value]
+ manticore/platforms/evm.py:3376:9: error: Returning Any from function declared to return "None"  [no-any-return]

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/util/typing.py:215:39: error: "Never" has no attribute "__forward_arg__"  [attr-defined]

schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/schema.py:532:16: error: Need type annotation for "avro"  [var-annotated]
+ schema_salad/schema.py:532:16: note: See https://kotlinisland.github.io/basedmypy/_refs.html#code-var-annotated for more info
- schema_salad/tests/test_cg.py:89:1: note: See https://kotlinisland.github.io/basedmypy/_refs.html#code-var-annotated for more info

yarl (https://github.com/aio-libs/yarl)
- tests/test_url.py: note: In function "test_url_is_not_str":
- tests/test_url.py:48:27: error: Intersection of "URL & str" cannot exist: would have incompatible method signatures  [unreachable]
- tests/test_url.py:48:27: note: See https://kotlinisland.github.io/basedmypy/_refs.html#code-unreachable for more info
+ yarl/_url.py:386:9: note: See https://kotlinisland.github.io/basedmypy/_refs.html#code-unreachable for more info

spark (https://github.com/apache/spark)
- python/pyspark/pandas/generic.py:786:25: error: Intersection of "bool & list[Any]" cannot exist: would have incompatible method signatures  [unreachable]

dulwich (https://github.com/dulwich/dulwich)
- dulwich/repo.py:1034:36: error: Intersection of "bool & str" cannot exist: would have incompatible method signatures  [unreachable]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant