Improve AMBIGUOUS_CALLS renderer
This commit is contained in:
@@ -30,10 +30,11 @@ object IdeRenderers {
|
||||
|
||||
@JvmField val HTML_AMBIGUOUS_CALLS = Renderer {
|
||||
calls: Collection<ResolvedCall<*>> ->
|
||||
calls
|
||||
val descriptors = calls
|
||||
.map { it.resultingDescriptor }
|
||||
.sortedWith(MemberComparator.INSTANCE)
|
||||
.joinToString("") { "<li>${DescriptorRenderer.HTML.render(it)}</li>" }
|
||||
val context = RenderingContext.Impl(descriptors)
|
||||
descriptors.joinToString("") { "<li>${HTML.render(it, context)}</li>" }
|
||||
}
|
||||
|
||||
@JvmField val HTML_RENDER_TYPE = SmartTypeRenderer(DescriptorRenderer.HTML)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// !DIAGNOSTICS_NUMBER: 1
|
||||
// !DIAGNOSTICS: OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
// !MESSAGE_TYPE: HTML
|
||||
|
||||
package a.b
|
||||
|
||||
val ref1 = ::foo
|
||||
|
||||
fun <T> foo(a: kotlin.String, t: T) {
|
||||
|
||||
}
|
||||
|
||||
fun <T> foo(b: String, t : T) {
|
||||
|
||||
}
|
||||
|
||||
fun foo(i: Int) {
|
||||
|
||||
}
|
||||
|
||||
class String
|
||||
@@ -0,0 +1,9 @@
|
||||
<!-- overloadResolutionAmbiguityHtml1 -->
|
||||
<html>
|
||||
Overload resolution ambiguity. All these functions match.
|
||||
<ul>
|
||||
<li><b>public</b> <b>fun</b> <`T> foo(b: a.b.String, t: ???): Unit <i>defined in</i> a.b</li>
|
||||
<li><b>public</b> <b>fun</b> foo(i: Int): Unit <i>defined in</i> a.b</li>
|
||||
<li><b>public</b> <b>fun</b> <`T> foo(a: kotlin.String, t: ???): Unit <i>defined in</i> a.b</li>
|
||||
</ul>
|
||||
</html>
|
||||
@@ -0,0 +1,21 @@
|
||||
// !DIAGNOSTICS_NUMBER: 1
|
||||
// !DIAGNOSTICS: OVERLOAD_RESOLUTION_AMBIGUITY
|
||||
// !MESSAGE_TYPE: TEXT
|
||||
|
||||
package a.b
|
||||
|
||||
val ref1 = ::foo
|
||||
|
||||
fun <T> foo(a: kotlin.String, t: T) {
|
||||
|
||||
}
|
||||
|
||||
fun <T> foo(b: String, t : T) {
|
||||
|
||||
}
|
||||
|
||||
fun foo(i: Int) {
|
||||
|
||||
}
|
||||
|
||||
class String
|
||||
@@ -0,0 +1,5 @@
|
||||
<!-- overloadResolutionAmbiguityTxt1 -->
|
||||
Overload resolution ambiguity:
|
||||
public fun <T> foo(b: a.b.String, t: ???): Unit defined in a.b
|
||||
public fun foo(i: Int): Unit defined in a.b
|
||||
public fun <T> foo(a: kotlin.String, t: ???): Unit defined in a.b
|
||||
@@ -179,6 +179,18 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadResolutionAmbiguityHtml.kt")
|
||||
public void testOverloadResolutionAmbiguityHtml() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/overloadResolutionAmbiguityHtml.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadResolutionAmbiguityTxt.kt")
|
||||
public void testOverloadResolutionAmbiguityTxt() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/overloadResolutionAmbiguityTxt.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("renderCollectionOfTypes.kt")
|
||||
public void testRenderCollectionOfTypes() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/renderCollectionOfTypes.kt");
|
||||
|
||||
Reference in New Issue
Block a user