Added captured types and approximation

CapturedType captures type projection while solving the constraint system.
During the substitution type containing captured types is approximated
to get rid of captured types and (for simple cases) replace them with corresponding type projections.

Note that Array<Array< CapturedType(out Int) >> is (over)approximated by Array<out<Array<out Int>>

See 'Mixed-site variance' by Ross Tate for details.

 #KT-2570 Fixed
 #KT-2872 Fixed
 #KT-3213 Fixed
This commit is contained in:
Svetlana Isakova
2014-09-23 15:29:47 +04:00
parent e798b7c6d1
commit cd359a046c
36 changed files with 798 additions and 114 deletions
@@ -116,6 +116,7 @@ import org.jetbrains.jet.lang.resolve.java.AbstractJavaTypeSubstitutorTest
import org.jetbrains.jet.plugin.intentions.declarations.AbstractJoinLinesTest
import org.jetbrains.jet.codegen.AbstractScriptCodegenTest
import org.jetbrains.jet.plugin.parameterInfo.AbstractFunctionParameterInfoTest
import org.jetbrains.jet.resolve.typeApproximation.AbstractCapturedTypeApproximationTest
import org.jetbrains.jet.psi.patternMatching.AbstractJetPsiUnifierTest
import org.jetbrains.jet.completion.weighers.AbstractBasicCompletionWeigherTest
import org.jetbrains.jet.completion.weighers.AbstractSmartCompletionWeigherTest
@@ -167,6 +168,10 @@ fun main(args: Array<String>) {
model("constraintSystem", extension = "bounds")
}
testClass(javaClass<AbstractCapturedTypeApproximationTest>()) {
model("capturedTypeApproximation")
}
testClass(javaClass<AbstractJetParsingTest>()) {
model("psi", testMethod = "doParsingTest", pattern = "^(.*)\\.kts?$")
model("parseCodeFragment/expression", testMethod = "doExpressionCodeFragmentParsingTest", extension = "kt")