Skip to content

Commit 80b4891

Browse files
authored
[ty] Temporarily disable tuple types in property tests (#28275)
1 parent 3f7a54d commit 80b4891

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

‎crates/ty_python_semantic/src/types/property_tests/type_generation.rs‎

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub(crate) enum Ty {
5656
neg: Vec<Ty>,
5757
},
5858
FixedLengthTuple(Vec<Ty>),
59+
#[expect(dead_code, reason = "Tuple generation is temporarily disabled")]
5960
VariableLengthTuple(Vec<Ty>, Box<Ty>, Vec<Ty>),
6061
SubclassOfAny,
6162
SubclassOfBuiltinClass(&'static str),
@@ -544,42 +545,44 @@ fn arbitrary_type(g: &mut Gen, size: u32, fully_static: bool) -> Ty {
544545
if size == 0 {
545546
arbitrary_core_type(g, fully_static)
546547
} else {
547-
match u32::arbitrary(g) % 6 {
548+
match u32::arbitrary(g) % 4 {
548549
0 => arbitrary_core_type(g, fully_static),
549550
1 => Ty::Union(
550551
(0..*g.choose(&[2, 3]).unwrap())
551552
.map(|_| arbitrary_type(g, size - 1, fully_static))
552553
.collect(),
553554
),
554-
2 => Ty::FixedLengthTuple(
555-
(0..*g.choose(&[0, 1, 2]).unwrap())
556-
.map(|_| arbitrary_type(g, size - 1, fully_static))
557-
.collect(),
558-
),
559-
3 => Ty::VariableLengthTuple(
560-
(0..*g.choose(&[0, 1, 2]).unwrap())
561-
.map(|_| arbitrary_type(g, size - 1, fully_static))
562-
.collect(),
563-
Box::new(arbitrary_type(g, size - 1, fully_static)),
564-
(0..*g.choose(&[0, 1, 2]).unwrap())
565-
.map(|_| arbitrary_type(g, size - 1, fully_static))
566-
.collect(),
567-
),
568-
4 => Ty::Intersection {
555+
2 => Ty::Intersection {
569556
pos: (0..*g.choose(&[0, 1, 2]).unwrap())
570557
.map(|_| arbitrary_type(g, size - 1, fully_static))
571558
.collect(),
572559
neg: (0..*g.choose(&[0, 1, 2]).unwrap())
573560
.map(|_| arbitrary_type(g, size - 1, fully_static))
574561
.collect(),
575562
},
576-
5 => Ty::Callable {
563+
3 => Ty::Callable {
577564
params: match u32::arbitrary(g) % 2 {
578565
0 if !fully_static => CallableParams::GradualForm,
579566
_ => CallableParams::List(arbitrary_parameter_list(g, size, fully_static)),
580567
},
581568
returns: Box::new(arbitrary_type(g, size - 1, fully_static)),
582569
},
570+
// TODO: Re-enable tuple types once they are fixed, and change the modulus back to 6.
571+
// See https://github.com/astral-sh/ty/issues/4263.
572+
// 4 => Ty::FixedLengthTuple(
573+
// (0..*g.choose(&[0, 1, 2]).unwrap())
574+
// .map(|_| arbitrary_type(g, size - 1, fully_static))
575+
// .collect(),
576+
// ),
577+
// 5 => Ty::VariableLengthTuple(
578+
// (0..*g.choose(&[0, 1, 2]).unwrap())
579+
// .map(|_| arbitrary_type(g, size - 1, fully_static))
580+
// .collect(),
581+
// Box::new(arbitrary_type(g, size - 1, fully_static)),
582+
// (0..*g.choose(&[0, 1, 2]).unwrap())
583+
// .map(|_| arbitrary_type(g, size - 1, fully_static))
584+
// .collect(),
585+
// ),
583586
_ => unreachable!(),
584587
}
585588
}

0 commit comments

Comments
 (0)