Pyright: Pyright can't infer type for __rmatmul__

Created on 18 Jun 2020  路  2Comments  路  Source: microsoft/pyright

Describe the bug
Pyright doesn't seem to infer base on RHS of expression a @ b, while __rmul__ and dunder function call works fine.

To Reproduce
Create file with the code below

Expected behavior
The code should type check

Screenshots or Code

class A():  pass
class B():
  def __rmul__(self, a: A): pass
  def __rmatmul__(self, a: A): pass
  def __matmul__(self, a: A): pass

a, b = A(), B()

a * b
a @ b   # <<< red squiggly here
b.__rmatmul__(a)
b @ a

VS Code extension or command-line
VS Code extension 1.1.43

Additional context
pass

addressed in next version bug

All 2 comments

Thanks for the bug report. This will be fixed in the next published version of Pyright.

This is now fixed in version 1.1.44, which I just published.

Was this page helpful?
0 / 5 - 0 ratings