Skip to content

Wrong type of exponentiation with integer base and power #1259

@eternalphane

Description

@eternalphane

Wrong type inference of integer raised to power of any integer other than literal 2

Environment data

  • Language Server version: 2021.5.2-pre.1
  • OS and version: Windows 10
  • Python version (and distribution if applicable, e.g. Anaconda): 3.9.5 (pipenv)
  • python.analysis.indexing: true
  • python.analysis.typeCheckingMode: off

Expected behaviour

a = 10**1
b = 10**3
c = 10**int(2)

Type of both a, b and c should be inferred as int.

Actual behaviour

image
image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions