J2K TypeSubstitution: Convert
This commit is contained in:
+1
-1
@@ -525,7 +525,7 @@ private fun TypeSubstitutor.setApproximateCapturedTypes(): TypeSubstitutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class SubstitutionWithCapturedTypeApproximation(val substitution: TypeSubstitution) : TypeSubstitution() {
|
private class SubstitutionWithCapturedTypeApproximation(val substitution: TypeSubstitution) : TypeSubstitution() {
|
||||||
override fun get(key: TypeConstructor?) = substitution[key]
|
override fun get(key: TypeConstructor) = substitution[key]
|
||||||
override fun isEmpty() = substitution.isEmpty()
|
override fun isEmpty() = substitution.isEmpty()
|
||||||
override fun approximateCapturedTypes() = true
|
override fun approximateCapturedTypes() = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ public fun approximateCapturedTypesIfNecessary(typeProjection: TypeProjection?):
|
|||||||
|
|
||||||
private fun substituteCapturedTypes(typeProjection: TypeProjection): TypeProjection? {
|
private fun substituteCapturedTypes(typeProjection: TypeProjection): TypeProjection? {
|
||||||
val typeSubstitutor = TypeSubstitutor.create(object : TypeSubstitution() {
|
val typeSubstitutor = TypeSubstitutor.create(object : TypeSubstitution() {
|
||||||
override fun get(typeConstructor: TypeConstructor?): TypeProjection? {
|
override fun get(key: TypeConstructor): TypeProjection? {
|
||||||
return (typeConstructor as? CapturedTypeConstructor)?.typeProjection
|
return (key as? CapturedTypeConstructor)?.typeProjection
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return typeSubstitutor.substituteWithoutApproximation(typeProjection)
|
return typeSubstitutor.substituteWithoutApproximation(typeProjection)
|
||||||
|
|||||||
@@ -14,36 +14,22 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.types;
|
package org.jetbrains.kotlin.types
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import kotlin.platform.platformStatic
|
||||||
|
|
||||||
public abstract class TypeSubstitution {
|
public abstract class TypeSubstitution {
|
||||||
public static final TypeSubstitution EMPTY = new TypeSubstitution() {
|
companion object {
|
||||||
@Override
|
platformStatic public val EMPTY: TypeSubstitution = object : TypeSubstitution() {
|
||||||
public TypeProjection get(TypeConstructor key) {
|
override fun get(key: TypeConstructor) = null
|
||||||
return null;
|
override fun isEmpty() = true
|
||||||
|
override fun toString() = "Empty TypeSubstitution"
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isEmpty() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Empty TypeSubstitution";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public abstract TypeProjection get(TypeConstructor key);
|
|
||||||
|
|
||||||
public boolean isEmpty() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean approximateCapturedTypes() {
|
public abstract fun get(key: TypeConstructor): TypeProjection?
|
||||||
return false;
|
|
||||||
}
|
public open fun isEmpty(): Boolean = false
|
||||||
|
|
||||||
|
public open fun approximateCapturedTypes(): Boolean = false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user