Skip to content

no error on invalid call to __init_subclass__ #3447

@DetachHead

Description

@DetachHead

Describe the Bug

class Foo:
    def __init_subclass__(cls, asdf: int) -> None:
        pass


class Bar(Foo, asdf=1): ...
class Baz(Foo, asdf=""): ... # no error
class Qux(Foo): ... # no error

it looks like pyrefly doesn't support __init_subclass__ at all. bad-typed-dict special-cases it for TypedDict, but ideally that rule should be removed and replaced with a more general rule that checks __init_subclass__ calls on any class

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIAxlKnHAAQBiuuiAOuvV-ZjGPQH0BEdBAAuAuAFds1WnCEAKanAA09WpjCJ6IsQEp6AWgB89AHK50Mdp273i8js-Ry69AEKoAToua51TTAAXgBGfR1CKI43Bi8ALz8WQLgtYLYQDIj6KMIYmncARSl8JNxs3JBVEDJvPihSQjFcAFsoCjIxAAsrIwA3GG84CCt6YPoMgGZCUIAmDI4AbUHvXCGAXQ4MdFwxVDER9CMWiDgW-cousfoAchW1m44QAF9q1EoDgcZoGAo0LDwRDILyAA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions