fixed test data

type mismatch with nothing (after change in ConstraintSystemImpl)
render 'CANT_INFER' type as '???'
This commit is contained in:
Svetlana Isakova
2013-03-04 14:05:47 +04:00
parent 1d55e359a5
commit d7412ecd9f
5 changed files with 36 additions and 5 deletions
@@ -26,6 +26,7 @@ import org.jetbrains.jet.lang.descriptors.annotations.Annotated;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.descriptors.impl.DeclarationDescriptorVisitorEmptyBodies;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.calls.CallResolverUtil;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
import org.jetbrains.jet.lang.resolve.name.Name;
@@ -195,16 +196,16 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
}
private String renderTypeWithoutEscape(@NotNull JetType type) {
if (type == ExpressionTypingUtils.CANNOT_BE_INFERRED) {
if (type == ExpressionTypingUtils.CANNOT_BE_INFERRED || type == CallResolverUtil.CANT_INFER) {
return "???";
}
else if (ErrorUtils.isErrorType(type)) {
if (ErrorUtils.isErrorType(type)) {
return type.toString();
}
else if (KotlinBuiltIns.getInstance().isUnit(type)) {
if (KotlinBuiltIns.getInstance().isUnit(type)) {
return KotlinBuiltIns.UNIT_ALIAS + (type.isNullable() ? "?" : "");
}
else if (KotlinBuiltIns.getInstance().isFunctionOrExtensionFunctionType(type)) {
if (KotlinBuiltIns.getInstance().isFunctionOrExtensionFunctionType(type)) {
return renderFunctionType(type);
}
return renderDefaultType(type);
@@ -5,7 +5,7 @@ trait A<T>
fun infer<T>(<!UNUSED_PARAMETER!>a<!>: A<T>) : T {<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun test(nothing: Nothing?) {
val <!UNUSED_VARIABLE!>i<!> = <!TYPE_INFERENCE_TYPE_CONSTRUCTOR_MISMATCH!>infer<!>(nothing)
val <!UNUSED_VARIABLE!>i<!> = <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>infer<!>(<!TYPE_MISMATCH!>nothing<!>)
}
fun sum(<!UNUSED_PARAMETER!>a<!> : IntArray) : Int {
@@ -0,0 +1,9 @@
package b
trait A<T>
fun infer<T>(a: A<T>) : T {}
fun foo(nothing: Nothing?) {
val i = infer(nothing)
}
@@ -0,0 +1,17 @@
<!-- typeMismatchWithNothing1 -->
<html>
Type mismatch.<table>
<tr>
<td>
Required:</td>
<td>
b.A&lt;???&gt;</td>
</tr>
<tr>
<td>
Found:</td>
<td>
jet.Nothing?</td>
</tr>
</table>
</html>
@@ -106,4 +106,8 @@ public class DiagnosticMessageTest extends JetLiteFixture {
public void testUpperBoundViolated() throws Exception {
doTest("upperBoundViolated", 1, Errors.TYPE_INFERENCE_UPPER_BOUND_VIOLATED);
}
public void testTypeMismatchWithNothing() throws Exception {
doTest("typeMismatchWithNothing", 1, Errors.TYPE_MISMATCH);
}
}