Skip to content

assert_type with metaclasses #3228

@QEDady

Description

@QEDady

Describe the Bug

Pyrefly is ok with the following:

from typing import assert_type
class meta(type):
    ...
class A(metaclass=meta):
    ...
reveal_type(A) # type[A]
# The following is ok with Pyrefly.
# Other type checkers: expected "meta" but received "type[A]"  
assert_type(A, meta) 

However, erroring is more on line with the spec since type[A] is not equivalent to meta

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEALqcROgOZ0Q3G6UN2o4cGHwD6TYjAA66AMZRBcOjRgNUACgkwAlIhl0DdQsZnzFdAILqVas0IC8N1Lv2HjhGZRgA3GKijizDDqFtp0AMSMQQDaFgC6MpEAKgAWMHRguFBQuADurBwQSrgA1nT5DCl0AAqkXmBQpB7okQDylSJRknSyabIlInCIdDD4krIMMJh0UiBOs3TYAK78XrIwEL7Ts1qxCSAGMooiDIGSIQA0yqrOM%2BgyIBcgZPWNhAy0UBSRta%2BkdGgsHh8D1cOhIGwlpRUAwIGDmpEAMowdIpBgMYhDAD0WJeMAaTV4bCxMHQWMwuFkcCxsjBEKhMLhZIyvAE3lQ0FQ2FgoPBEEh0NhYLouGIQvQcGaZEqYIAtL5KHAmXR7DMQABmQgARgATLMZNERNRFQl0Et0FweHwprLMBA1rDfCq6AByfnoXgwF0yD0MWVeACOS3tNoGpFlqFk6yEzpduVQlHQ3vQIAAvk9I46YAAxaAwCiAnAEEjkVNAA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions