No parameter names in types for error messages

This commit is contained in:
Valentin Kipyatkov
2016-09-14 16:15:04 +03:00
parent 6527ada775
commit 3bd39df587
11 changed files with 32 additions and 10 deletions
@@ -37,7 +37,7 @@ object IdeRenderers {
descriptors.joinToString("") { "<li>${HTML.render(it, context)}</li>" }
}
@JvmField val HTML_RENDER_TYPE = SmartTypeRenderer(DescriptorRenderer.HTML)
@JvmField val HTML_RENDER_TYPE = SmartTypeRenderer(DescriptorRenderer.HTML.withOptions { parameterNamesInFunctionalTypes = false })
@JvmField val HTML_NONE_APPLICABLE_CALLS = Renderer {
calls: Collection<ResolvedCall<*>> ->
+1 -1
View File
@@ -18,7 +18,7 @@ Type inference failed:
<td style="white-space:nowrap;"></td>
<td style="white-space:nowrap;"></td>
<td style="white-space:nowrap;"><b>(</b></td>
<td align="right" style="white-space:nowrap;"><font color=red><b>(x: ???) &rarr; ???</b></font></td>
<td align="right" style="white-space:nowrap;"><font color=red><b>(???) &rarr; ???</b></font></td>
<td style="white-space:nowrap;"><b>)</b></td>
</tr>
</table>
@@ -0,0 +1,9 @@
// !DIAGNOSTICS_NUMBER: 1
// !DIAGNOSTICS: TYPE_MISMATCH
// !MESSAGE_TYPE: TEXT
fun foo(handler: (s: String) -> Unit) {
bar(handler)
}
fun bar(a: (n: Int) -> Unit) {}
@@ -0,0 +1,2 @@
<!-- typeMismatchWithFunctionalType1 -->
Type mismatch: inferred type is (String) -> Unit but (Int) -> Unit was expected
@@ -9,8 +9,8 @@
// ACTION: Rename reference
// ERROR: A 'return' expression required in a function with a block body ('{...}')
// ERROR: The expression cannot be a selector (occur after a dot)
// ERROR: Type inference failed: inline fun <T> Iterable<T>.firstOrNull(predicate: (T) -> Boolean): T?<br>cannot be applied to<br>receiver: Collection<List<String>> arguments: ((group: List<String>) -> () -> Boolean)<br>
// ERROR: Type mismatch: inferred type is (group: List<String>) -> () -> Boolean but (List<String>) -> Boolean was expected
// ERROR: Type inference failed: inline fun <T> Iterable<T>.firstOrNull(predicate: (T) -> Boolean): T?<br>cannot be applied to<br>receiver: Collection<List<String>> arguments: ((List<String>) -> () -> Boolean)<br>
// ERROR: Type mismatch: inferred type is (List<String>) -> () -> Boolean but (List<String>) -> Boolean was expected
// ERROR: Unresolved reference: maximumSizeOfGroup
fun doSomethingStrangeWithCollection(collection: Collection<String>): Collection<String>? {
@@ -6,7 +6,7 @@
// ACTION: Create type alias 'NoSuchType'
// ACTION: Remove explicit lambda parameter types (may break code)
// ACTION: Create type parameter 'NoSuchType' in function 'foo'
// ERROR: Type mismatch: inferred type is (x: [ERROR : NoSuchType]) -> Int but Int was expected
// ERROR: Type mismatch: inferred type is ([ERROR : NoSuchType]) -> Int but Int was expected
// ERROR: Unresolved reference: NoSuchType
fun foo(): Int {
@@ -251,6 +251,12 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes
doTest(fileName);
}
@TestMetadata("typeMismatchWithFunctionalType.kt")
public void testTypeMismatchWithFunctionalType() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/typeMismatchWithFunctionalType.kt");
doTest(fileName);
}
@TestMetadata("typeMismatchWithNothing.kt")
public void testTypeMismatchWithNothing() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/typeMismatchWithNothing.kt");