mirror of
https://github.com/microsoft/pyright.git
synced 2024-10-26 10:55:06 +03:00
Fixed bug that resulted in false positive error when using a member access expression within a list of base classes in a class declaration statement.
This commit is contained in:
parent
28c431ef33
commit
648ae44bfe
@ -3926,7 +3926,12 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
||||
}
|
||||
}
|
||||
|
||||
if (isTypeVar(type) && (flags & EvaluatorFlags.ExpectingType) === 0 && type.details.name === name) {
|
||||
if (
|
||||
isTypeVar(type) &&
|
||||
!type.details.isParamSpec &&
|
||||
(flags & EvaluatorFlags.ExpectingType) === 0 &&
|
||||
type.details.name === name
|
||||
) {
|
||||
// Handle the special case of a PEP 604 union. These can appear within
|
||||
// an implied type alias where we are not expecting a type.
|
||||
const isPep604Union =
|
||||
@ -4332,8 +4337,7 @@ export function createTypeEvaluator(importLookup: ImportLookup, evaluatorOptions
|
||||
const baseTypeFlags =
|
||||
EvaluatorFlags.DoNotSpecialize |
|
||||
(flags &
|
||||
(EvaluatorFlags.ExpectingType |
|
||||
EvaluatorFlags.ExpectingTypeAnnotation |
|
||||
(EvaluatorFlags.ExpectingTypeAnnotation |
|
||||
EvaluatorFlags.VariableTypeAnnotation |
|
||||
EvaluatorFlags.AllowForwardReferences |
|
||||
EvaluatorFlags.NotParsedByInterpreter |
|
||||
|
@ -2,6 +2,9 @@
|
||||
# handle various class definition cases.
|
||||
|
||||
|
||||
from typing import Type
|
||||
|
||||
|
||||
class Foo:
|
||||
pass
|
||||
|
||||
@ -22,3 +25,18 @@ class Bar3(Foo, metaclass=type, metaclass=type):
|
||||
|
||||
class Bar4(Foo, other_keyword=2):
|
||||
pass
|
||||
|
||||
|
||||
class A:
|
||||
...
|
||||
|
||||
|
||||
class B:
|
||||
C: Type[A]
|
||||
|
||||
|
||||
app = B()
|
||||
|
||||
|
||||
class D(app.C):
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user