Incorrect comparison to default bound fixed

This commit is contained in:
Andrey Breslav
2012-10-17 12:21:10 +04:00
parent 3121f1ad5c
commit ee5b50cb1b
4 changed files with 6 additions and 6 deletions
@@ -599,7 +599,7 @@ public class DescriptorRenderer implements Renderer<DeclarationDescriptor> {
renderName(descriptor, builder);
if (descriptor.getUpperBounds().size() == 1) {
JetType upperBound = descriptor.getUpperBounds().iterator().next();
if (upperBound != KotlinBuiltIns.getInstance().getDefaultBound()) {
if (!KotlinBuiltIns.getInstance().getDefaultBound().equals(upperBound)) {
builder.append(" : ").append(renderType(upperBound));
}
}
@@ -43,12 +43,12 @@ public class BoundsSubstitutorTest extends KotlinTestWithEnvironment {
public void testSimpleSubstitution() throws Exception {
doTest("fun <T> f(l: List<T>): T",
"fun <T : jet.Any?> f(l : jet.List<jet.Any?>) : jet.Any?");
"fun <T> f(l : jet.List<jet.Any?>) : jet.Any?");
}
public void testParameterInBound() throws Exception {
doTest("fun <T, R : List<T>> f(l: List<R>): R",
"fun <T : jet.Any?, R : jet.List<jet.Any?>> f(l : jet.List<jet.List<jet.Any?>>) : jet.List<jet.Any?>");
"fun <T, R : jet.List<jet.Any?>> f(l : jet.List<jet.List<jet.Any?>>) : jet.List<jet.Any?>");
}
public void testWithWhere() throws Exception {
@@ -176,7 +176,7 @@ public abstract class OverrideImplementMethodsHandler implements LanguageCodeIns
boolean firstUpperBound = true;
for (JetType upperBound : upperBounds) {
String upperBoundText = " : " + renderType(upperBound);
if (upperBound != KotlinBuiltIns.getInstance().getDefaultBound()) {
if (!KotlinBuiltIns.getInstance().getDefaultBound().equals(upperBound)) {
if (firstUpperBound) {
bodyBuilder.append(upperBoundText);
} else {
@@ -7,7 +7,7 @@ package testData.libraries
[public final val jet.String.exProp : jet.String] /* compiled code */
[public final val <T : jet.Any?>testData.libraries.Pair<T, T>.exProp : jet.String] /* compiled code */
[public final val <T>testData.libraries.Pair<T, T>.exProp : jet.String] /* compiled code */
[public final val globalVal : testData.libraries.Pair<jet.Int, jet.String>] /* compiled code */
@@ -23,4 +23,4 @@ package testData.libraries
[public final fun main(args : jet.Array<jet.String>) : Unit { /* compiled code */ }]
[public final fun <T : jet.Any?> T.filter(predicate : (T) -> jet.Boolean) : T? { /* compiled code */ }]
[public final fun <T> T.filter(predicate : (T) -> jet.Boolean) : T? { /* compiled code */ }]