Updated constraint system tests

This commit is contained in:
Svetlana Isakova
2015-06-27 15:50:39 +03:00
parent cf64687b02
commit 1463ff7258
22 changed files with 37 additions and 17 deletions
@@ -12,6 +12,7 @@ status:
-hasContradiction: true -hasContradiction: true
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: true
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: false -isSuccessful: false
@@ -12,9 +12,10 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
result: result:
T=Int T=Int
@@ -11,6 +11,7 @@ status:
-hasContradiction: true -hasContradiction: true
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: true -hasTypeConstructorMismatch: true
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: true -hasUnknownParameters: true
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: false -isSuccessful: false
@@ -11,6 +11,7 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: true -hasUnknownParameters: true
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: false -isSuccessful: false
@@ -12,6 +12,7 @@ status:
-hasContradiction: true -hasContradiction: true
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: true -hasViolatedUpperBound: true
-isSuccessful: false -isSuccessful: false
@@ -12,6 +12,7 @@ status:
-hasContradiction: true -hasContradiction: true
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: true
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: false -isSuccessful: false
@@ -12,6 +12,7 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
@@ -12,6 +12,7 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
@@ -13,6 +13,7 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
@@ -12,6 +12,7 @@ status:
-hasContradiction: true -hasContradiction: true
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: true
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: false -isSuccessful: false
@@ -12,9 +12,10 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
result: result:
T=Long T=Long
@@ -12,9 +12,10 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
result: result:
T=Int T=Int
@@ -12,9 +12,10 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
result: result:
T=Comparable<out Any?> T=Comparable<out Any?>
@@ -12,9 +12,10 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
result: result:
T=Int T=Int
@@ -12,9 +12,10 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
result: result:
T=Byte T=Byte
@@ -11,9 +11,10 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
result: result:
T=Int T=Int
@@ -12,9 +12,10 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
result: result:
T=Short T=Short
@@ -3,8 +3,8 @@ VARIABLES T P
SUBTYPE T Int SUBTYPE T Int
type parameter bounds: type parameter bounds:
T <: Int T >: P, <: Int
P <: Int P <: T, <: Int
status: status:
-hasCannotCaptureTypesError: false -hasCannotCaptureTypesError: false
@@ -12,10 +12,11 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
result: result:
T=Int T=Int
P=Int P=Int
@@ -11,6 +11,7 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
@@ -11,6 +11,7 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
@@ -11,6 +11,7 @@ status:
-hasContradiction: false -hasContradiction: false
-hasErrorInConstrainingTypes: false -hasErrorInConstrainingTypes: false
-hasTypeConstructorMismatch: false -hasTypeConstructorMismatch: false
-hasTypeInferenceIncorporationError: false
-hasUnknownParameters: false -hasUnknownParameters: false
-hasViolatedUpperBound: false -hasViolatedUpperBound: false
-isSuccessful: true -isSuccessful: true
@@ -105,15 +105,14 @@ abstract public class AbstractConstraintSystemTest() : JetLiteFixture() {
val resultingStatus = Renderers.RENDER_CONSTRAINT_SYSTEM_SHORT.render(constraintSystem) val resultingStatus = Renderers.RENDER_CONSTRAINT_SYSTEM_SHORT.render(constraintSystem)
val resultingSubstitutor = constraintSystem.getResultingSubstitutor() val resultingSubstitutor = constraintSystem.getResultingSubstitutor()
val result = StringBuilder() append "result:\n" val result = typeParameterDescriptors.map {
for (typeParameter in typeParameterDescriptors) { val parameterType = testDeclarations.getType(it.getName().asString())
val parameterType = testDeclarations.getType(typeParameter.getName().asString())
val resultType = resultingSubstitutor.substitute(parameterType, Variance.INVARIANT) val resultType = resultingSubstitutor.substitute(parameterType, Variance.INVARIANT)
result append "${typeParameter.getName()}=${resultType?.let{ DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(it) }}\n" "${it.getName()}=${resultType?.let{ DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(it) }}"
} }.join("\n", prefix = "result:\n")
val boundsFile = File(filePath.replace("constraints", "bounds")) val boundsFile = File(filePath.replace("constraints", "bounds"))
JetTestUtils.assertEqualsToFile(boundsFile, "$constraintsFileText\n\n$resultingStatus\n\n$result\n") JetTestUtils.assertEqualsToFile(boundsFile, "$constraintsFileText\n\n$resultingStatus\n\n$result")
} }
class MyConstraint(val kind: MyConstraintKind, val firstType: String, val secondType: String, val isWeak: Boolean) class MyConstraint(val kind: MyConstraintKind, val firstType: String, val secondType: String, val isWeak: Boolean)