From 8871013c454d70c5e32f381aaaefdd833aaac9ce Mon Sep 17 00:00:00 2001 From: Oliver Nybroe Date: Tue, 12 Oct 2021 13:56:40 +0200 Subject: [PATCH] Fix higher order types crashes on immutable php types --- CHANGELOG.md | 6 ++++-- gradle.properties | 2 +- .../dev/nybroe/collector/types/HigherOrderTypeProvider.kt | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95f2a82..cacfbdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,12 @@ # collections-intellij Changelog ## [Unreleased] +### Fixed +- Fixed immutable php type issues ## [0.3.4] -### Fixed -- Fixed recursive collection on variables with no types +### Fixed +- Fixed recursive collection on variables with no types - Fix higher order type provider when no types are possible ## [0.3.3] diff --git a/gradle.properties b/gradle.properties index 12a610a..05dbc5c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ pluginGroup = dev.nybroe.collector pluginName = Collector -pluginVersion = 0.3.4 +pluginVersion = 0.3.5 # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # for insight into build numbers and IntelliJ Platform versions. diff --git a/src/main/kotlin/dev/nybroe/collector/types/HigherOrderTypeProvider.kt b/src/main/kotlin/dev/nybroe/collector/types/HigherOrderTypeProvider.kt index 2394355..196762c 100644 --- a/src/main/kotlin/dev/nybroe/collector/types/HigherOrderTypeProvider.kt +++ b/src/main/kotlin/dev/nybroe/collector/types/HigherOrderTypeProvider.kt @@ -58,8 +58,9 @@ class HigherOrderTypeProvider : PhpTypeProvider4 { // Resolve type of the signature. val type = PhpIndex.getInstance(project) .getBySignature(signature.split('|')[0]) - .map { it.type } - .reduceOrNull { acc, phpType -> acc.add(phpType) } + .map { PhpType.builder().add(it.type) } + .reduceOrNull { acc, phpType -> acc.merge(phpType) } + ?.build() ?.global(project) if (type === null) return null