Describe the bug
Final not allowed in the context of dataclasses.
To Reproduce
Steps to reproduce the behavior.
Consider this piece of code
from dataclasses import dataclass
from typing import Final
@dataclass
class Foo:
bar: Final[str] = "G.R. Emlin"
Hovering over the Final[str] produces an error:
"Final" is not allowed in this context
Expected behavior
Final shouldn't be labeled as not allowed in this context
Additional context
json
{
"pyright.typeCheckingMode": "strict",
"pyright.useLibraryCodeForTypes": true
}
Thanks for the bug report. This will be fixed in the next version of Pyright.
This is now fixed in version 1.1.45, which I just published.
@erictraut Thank you!
Btw, could you link a commit with the bug fix so I could see the actual implementation? :pray:
Sure, here's the commit for the bug fix: https://github.com/microsoft/pyright/commit/93e1fc731465bfdfaf6f842280ed232d07ded01d