refactoring: removed logic of rendering 'expected type mismatch' error from constraint system

This commit is contained in:
Svetlana Isakova
2013-09-27 17:41:53 +04:00
parent af930012d5
commit 4666b0f50c
7 changed files with 88 additions and 7 deletions
@@ -0,0 +1,11 @@
package s
fun <T> id(t: T): T = t
fun test(set: Set<Int>) {
val s: String = id(1)
val l: List<Int> = id(set)
val ss: Set<String> = id(set)
}
@@ -0,0 +1,23 @@
<!-- typeInferenceExpectedTypeMismatch1 -->
<html>
Type inference failed. Expected type mismatch: <table>
<tr>
<td>
required: </td>
<td>
<b>
jet.String</b>
</td>
</tr>
<tr>
<td>
found: </td>
<td>
<font color=red>
<b>
jet.Int</b>
</font>
</td>
</tr>
</table>
</html>
@@ -0,0 +1,23 @@
<!-- typeInferenceExpectedTypeMismatch2 -->
<html>
Type inference failed. Expected type mismatch: <table>
<tr>
<td>
required: </td>
<td>
<b>
jet.List&lt;jet.Int&gt;</b>
</td>
</tr>
<tr>
<td>
found: </td>
<td>
<font color=red>
<b>
jet.Set&lt;jet.Int&gt;</b>
</font>
</td>
</tr>
</table>
</html>
@@ -0,0 +1,23 @@
<!-- typeInferenceExpectedTypeMismatch3 -->
<html>
Type inference failed. Expected type mismatch: <table>
<tr>
<td>
required: </td>
<td>
<b>
jet.Set&lt;jet.String&gt;</b>
</td>
</tr>
<tr>
<td>
found: </td>
<td>
<font color=red>
<b>
jet.Set&lt;jet.Int&gt;</b>
</font>
</td>
</tr>
</table>
</html>
@@ -118,4 +118,8 @@ public class DiagnosticMessageTest extends JetLiteFixture {
doTest("numberValueTypes", 4, Errors.TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH, Errors.TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH,
Errors.TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS);
}
public void testTypeInferenceExpectedTypeMismatch() throws Exception {
doTest("typeInferenceExpectedTypeMismatch", 3, Errors.TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH);
}
}