Skip to content

Commit 95c8f72

Browse files
committed
Fix infinite loop in recursive generics
1 parent 6895e54 commit 95c8f72

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

tests/PHPStan/Analyser/AnalyserIntegrationTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,6 +1499,13 @@ public function testBug14324(): void
14991499
$this->assertNoErrors($errors);
15001500
}
15011501

1502+
public function testBug13801(): void
1503+
{
1504+
// endless loop crash
1505+
$errors = $this->runAnalyse(__DIR__ . '/data/bug-13801.php');
1506+
$this->assertNoErrors($errors);
1507+
}
1508+
15021509
/**
15031510
* @param string[]|null $allAnalysedFiles
15041511
* @return list<Error>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bug13801;
6+
7+
/**
8+
* @template TValue of object
9+
*/
10+
interface Cast
11+
{
12+
}
13+
14+
/**
15+
* @template TCast of Cast<static>
16+
*/
17+
interface Castable
18+
{
19+
}

0 commit comments

Comments
 (0)