1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix bad template replacement

This commit is contained in:
Matthew Brown 2020-02-27 23:00:40 -05:00
parent 39d6800531
commit abb3800d20
2 changed files with 34 additions and 2 deletions

View File

@ -1891,8 +1891,9 @@ class CallAnalyzer
[$template_type->param_name]
[$template_type->defining_class]
)) {
$template_result->generic_params[$template_type->param_name] = [
($template_type->defining_class) => [clone $template_type->as, 0]
$template_result->generic_params[$template_type->param_name][$template_type->defining_class] = [
clone $template_type->as,
0
];
}
}

View File

@ -3088,6 +3088,37 @@ class ClassTemplateExtendsTest extends TestCase
private function doDeletePerson(Dog $animal): void {}
}'
],
'sameNameTemplateFromParent' => [
'<?php
/**
* @psalm-template T
*/
interface C {
/**
* @psalm-param T $p
* @psalm-return C<T>
*/
public function filter($p) : self;
}
/**
* @psalm-template T
* @template-implements C<T>
*/
abstract class AC implements C {
/**
* @psalm-var C<T>
*/
protected $c;
/**
* @param T $p
*/
public function filter($p) : C {
return $this->c->filter($p);
}
}'
],
];
}