[red-knot] Allow explicit specialization of generic classes #17023
Build context for generic classes
3be82571
Handle explicit specialization before outputting lints
4c76cb5d
Explicitly specialize classes
80486048
Track those structs
fe76d56d
Add Specialization
4346e7d2
Add CallableType::Specialized
2380ade7
dcreager
force pushed
from
ca52aaae
to
2380ade7
270 days ago
dcreager
force pushed
from
e4af4122
to
ca1dfc3d
269 days ago
dcreager
force pushed
from
ca1dfc3d
to
20726299
269 days ago
dcreager
force pushed
from
20726299
to
d0a457c7
269 days ago
dcreager
force pushed
from
d0a457c7
to
cd5b3fbe
269 days ago
Use union to hold typevar constraints
178ee89d
Add Type::TypeVar variant
feb1ea9d
Fix failing tests
3c1ad797
doc Type::TypeVar
59430b64
More correct handling of final bounds/constraints
77ffa80d
use list[T] so generic funcs are callable even with Never
6f867204
lint
cf819679
Add (currently failing) narrowing tests
6615df18
Typevars _can_ be fully static I guess
b2f5a2a5
Simplify intersections with constrained typevars
590680cd
Merge branch 'main' into dcreager/typevar-type
e6b7d40a
Fix tests
debd60a5
lint
aa391fd2
Update crates/red_knot_python_semantic/src/types/type_ordering.rs
e57e62e0
Clarify that typevar is subtype of object too
3df79cc1
Clarify non-fully-static bounded typevars aren't subtypes
5b08e93b
Add more tests for constrained gradual typevars
82e810f9
Update crates/red_knot_python_semantic/src/types.rs
a3d72538
Simplify intersections with constrained typevars w/o glossing into union
15682d58
Simplify positive intersections too
9e07efe8
Intersection of constraints is subtype of typevar
fb63c224
Better descriptions of intersections of constrained typevars
34590562
Add multiple narrowing example
71d425e0
lint
233e9380
Sort typevar constraints
97852021
Remove moot todo
c86af502
Fold typevar match arms back into main match statement
aa008954
Remove moot comment
d99d1d75
Remove moot todo
58f0995c
Add more TODOs about OneOf connector
42fd54a5
add todos for unary/binary ops
6bd69f18
Merge remote-tracking branch 'origin/main' into dcreager/typevar-type
1d6a9179
Merge remote-tracking branch 'origin/dcreager/typevar-type' into dcre…
37692f15
Fix tests
3869dc68
Fix tests better
0c1745ba
Support unary and binary ops
8bdd9e2b
Merge remote-tracking branch 'origin/main' into dcreager/typevar-type
39244dd3
Merge remote-tracking branch 'origin/main' into dcreager/special-class
5694b3d3
Fix merge conflicts
123b9209
Rename to SpecializedCallable{,Type}
9e1767fc
Merge branch 'dcreager/typevar-type' into dcreager/special-class
23ac0b63
Specialize types
6b279475
Merge remote-tracking branch 'origin/main' into dcreager/special-class
669aa21f
Fix tests in ide crate
575998ea
dcreager
force pushed
from
cd5b3fbe
to
7d29d882
266 days ago
dcreager
force pushed
from
7d29d882
to
529413c3
266 days ago
Add GenericClass, NonGenericClass, and GenericAlias
f02fefa0
dcreager
force pushed
from
529413c3
to
f02fefa0
266 days ago
Add GenericAlias
cc3a3dfe
Apply specializations
18af8b6f
Use class literal for self member lookups
af52fd16
Display specializations and generic aliases
d3fd8226
Specialize generic base class in generic subclass
aa649909
Merge branch 'main' into dcreager/special-class
e41f8899
dcreager
force pushed
from
6450d5d9
to
e41f8899
265 days ago
Only specialize function literals, not all callables
7eb7c289
Fix descriptor protocol tests
adb4abaa
Merge branch 'main' into dcreager/special-class
968e6371
Remove unused methods
fd7914aa
clippy
7ebda981
Apply specialization to signature in-place
6257e89e
typo
78cd92ae
Fix test case
530e2bc1
lint
637fd484
Defer class definitions with string literals in base classes
ec5a5888
fix lint fix
27cb2083
skip failing test for now
ea125488
clippy and lint
c376dad1
add xfail for specializing to union of constraints
311dc596
specialize property types
5fc84254
Don't specialize function twice
7aaeb47a
fix docs
43554e2a
dcreager
marked this pull request as ready for review 262 days ago
carljm
commented
on 2025-04-08
carljm
approved these changes
on 2025-04-08
Merge remote-tracking branch 'origin/main' into dcreager/special-class
0d656db1
Better TODO fallback type
7c3405ad
Generic aliases are literals in type display
6593d90d
Explain self_instance not being specialized
7ca6a60b
Comment other non-specializations
dea493ef
Add xfail for generic method inside generic class
048bb8be
More Python-like displays for specializations
06859fa8
Narrow type(generic) better
d1384050
Better todos
0997eca7
Add TODO about property test data
6ab1b906
lint
bcb147ff
dcreager
merged
ff376fc2
into main 260 days ago
dcreager
deleted the dcreager/special-class branch 260 days ago
Assignees
No one assigned
Login to write a write a comment.
Login via GitHub