Refactoring. Remove getSubstitution from KotlinType.

This commit is contained in:
Stanislav Erokhin
2016-04-25 18:35:05 +03:00
parent 5fe48313e9
commit 926da77abe
11 changed files with 19 additions and 63 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,10 +23,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.psi.KtClass
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeConstructor
import org.jetbrains.kotlin.types.TypeUtils
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.boundClosure
import org.jetbrains.kotlin.types.typeUtil.constituentTypes
import org.jetbrains.kotlin.utils.DFS
@@ -118,7 +115,7 @@ object NonExpansiveInheritanceRestrictionChecker {
val originalTypeParameter = constituentTypeConstructor.parameters[i]
val bounds = hashSetOf<KotlinType>()
val substitutor = constituentType.substitution.buildSubstitutor()
val substitutor = TypeConstructorSubstitution.create(constituentType).buildSubstitutor()
val adaptedUpperBounds = originalTypeParameter.upperBounds.mapNotNull { substitutor.substitute(it, Variance.INVARIANT) }
bounds.addAll(adaptedUpperBounds)