mirror of
https://github.com/danog/psalm.git
synced 2025-01-10 15:09:04 +01:00
e6600fea21
Fixes #8983 This patch adds a basic test showing that, when reaching a union type with 30 elements or more, Psalm used to fail with an error, because the large union type got simplified into a more general type as part of performance optimizations done in `TypeCombiner::combine()`. This means that a type like `array<1|2|3|(etcetera...)|100, mixed>` was internally simplified to `array<int, mixed>`, after reaching 30 elements or more, which in turn led to problems and confusing errors when large union types are in play. Such union types are relatively common in lookup-table-alike value objects. By removing the hardcoded call-time limit of `30` types to be combined, we hereby rely on the default `TypeCombiner::combine()` limit of `500` items, which is more healthy. This may come with some performance implications, but it is worth trying out, for now. Further parameters passed to `TypeCombiner::combine()` that were already matching parameter default values were also omitted from the call-sites. |
||
---|---|---|
.. | ||
CodeLocation | ||
Config | ||
Exception | ||
Internal | ||
Issue | ||
Node | ||
Plugin | ||
Progress | ||
Report | ||
SourceControl | ||
Storage | ||
Type | ||
Aliases.php | ||
Codebase.php | ||
CodeLocation.php | ||
Config.php | ||
Context.php | ||
DocComment.php | ||
ErrorBaseline.php | ||
FileBasedPluginAdapter.php | ||
FileManipulation.php | ||
FileSource.php | ||
IssueBuffer.php | ||
NodeTypeProvider.php | ||
PluginFileExtensionsSocket.php | ||
PluginRegistrationSocket.php | ||
Report.php | ||
StatementsSource.php | ||
Type.php |