JS backend: fix get mangling name for generic methods with multiply upper bounds
This commit is contained in:
@@ -36,4 +36,8 @@ public final class NameClashesTest extends SingleFileTranslationTest {
|
|||||||
public void testDifferenceInCapitalization() throws Exception {
|
public void testDifferenceInCapitalization() throws Exception {
|
||||||
checkFooBoxIsOk();
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testMethodOverloadInClassWithTwoUpperBounds() throws Exception {
|
||||||
|
checkFooBoxIsOk();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -137,13 +137,17 @@ public final class TranslationUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static String getJetTypeFqName(@NotNull JetType jetType, boolean printTypeArguments) {
|
public static String getJetTypeFqName(@NotNull JetType jetType, final boolean printTypeArguments) {
|
||||||
ClassifierDescriptor declaration = jetType.getConstructor().getDeclarationDescriptor();
|
ClassifierDescriptor declaration = jetType.getConstructor().getDeclarationDescriptor();
|
||||||
assert declaration != null;
|
assert declaration != null;
|
||||||
|
|
||||||
if (declaration instanceof TypeParameterDescriptor) {
|
if (declaration instanceof TypeParameterDescriptor) {
|
||||||
TypeParameterDescriptor typeParameter = (TypeParameterDescriptor) declaration;
|
return StringUtil.join(((TypeParameterDescriptor) declaration).getUpperBounds(), new Function<JetType, String>() {
|
||||||
return getJetTypeFqName(typeParameter.getUpperBoundsAsType(), printTypeArguments);
|
@Override
|
||||||
|
public String fun(JetType type) {
|
||||||
|
return getJetTypeFqName(type, printTypeArguments);
|
||||||
|
}
|
||||||
|
}, "&");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TypeProjection> typeArguments = jetType.getArguments();
|
List<TypeProjection> typeArguments = jetType.getArguments();
|
||||||
|
|||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
trait TraitA
|
||||||
|
trait TraitB
|
||||||
|
|
||||||
|
public open abstract class Node<T : TraitA>() where T : TraitB {
|
||||||
|
public abstract fun bar(arg: T): String
|
||||||
|
public abstract fun bar(arg: TraitA): String
|
||||||
|
public abstract fun bar(arg: TraitB): String
|
||||||
|
}
|
||||||
|
|
||||||
|
class ClassAB : TraitA, TraitB
|
||||||
|
|
||||||
|
public class MyNode : Node<ClassAB>() {
|
||||||
|
override fun bar(arg: ClassAB): String = "MyNode.bar(ClassAB)"
|
||||||
|
override fun bar(arg: TraitA): String = "MyNode.bar(TraitA)"
|
||||||
|
override fun bar(arg: TraitB): String = "MyNode.bar(TraitB)"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
|
||||||
|
var node = MyNode()
|
||||||
|
assertEquals("MyNode.bar(ClassAB)", node.bar(ClassAB()))
|
||||||
|
assertEquals("MyNode.bar(TraitA)", node.bar(ClassAB(): TraitA))
|
||||||
|
assertEquals("MyNode.bar(TraitB)", node.bar(ClassAB(): TraitB))
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user