Skip to content

Conversation

@InSyncWithFoo
Copy link
Contributor

Summary

Resolves #14891.

Test Plan

Markdown tests.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 11, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@InSyncWithFoo
Copy link
Contributor Author

This has one small problem: Inheriting from Type results in an MRO with both type and Generic, but Mro::of_class_impl() expects only one returned value from ClassBase::try_from_ty(). Fixing this would require quite a few significant changes here and there; should I try to do so, or should it be left as a TODO for now?

@MichaReiser MichaReiser added the ty Multi-file analysis & type inference label Dec 11, 2024
@AlexWaygood
Copy link
Member

This has one small problem: Inheriting from Type results in an MRO with both type and Generic, but Mro::of_class_impl() expects only one returned value from ClassBase::try_from_ty(). Fixing this would require quite a few significant changes here and there; should I try to do so, or should it be left as a TODO for now?

Fine to just TODO all that for now. We don't even understand that typing.Generic is a class at all right now!

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@AlexWaygood AlexWaygood enabled auto-merge (squash) December 11, 2024 10:57
@AlexWaygood AlexWaygood merged commit f30227c into astral-sh:main Dec 11, 2024
20 checks passed
@InSyncWithFoo InSyncWithFoo deleted the rk-typing-type branch December 11, 2024 12:54
TheBits pushed a commit to TheBits/ruff that referenced this pull request Dec 11, 2024
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>

class A: ...

def _(c: Type, d: Type[A], e: Type[A]):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the e argument exist here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't there originally. Probably a small oversight.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I think I screwed that up when simplifying the mdtests a little :-)

@carljm
Copy link
Contributor

carljm commented Dec 11, 2024

Nice, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[red-knot] Understand typing.Type

4 participants