Fixed argument for error message 'TYPE_PARAMETER_AS_REIFIED'

This commit is contained in:
Svetlana Isakova
2014-11-14 17:52:58 +03:00
parent 0719297d8f
commit 2948ca9077
4 changed files with 17 additions and 1 deletions
@@ -46,7 +46,7 @@ public class ReifiedTypeParameterSubstitutionCheck implements CallResolverExtens
!((TypeParameterDescriptor) argumentDeclarationDescription).isReified()
) {
context.trace.report(
Errors.TYPE_PARAMETER_AS_REIFIED.on(getCallElement(context), typeArguments.keySet().iterator().next())
Errors.TYPE_PARAMETER_AS_REIFIED.on(getCallElement(context), parameter)
);
}
else if (KotlinBuiltIns.getInstance().isNothingOrNullableNothing(argument)) {
@@ -0,0 +1,8 @@
// !DIAGNOSTICS_NUMBER: 1
// !DIAGNOSTICS: TYPE_PARAMETER_AS_REIFIED
public data class Pair<out A, out B>()
inline fun <R, reified T> f(): Pair<Array<R>, Array<T>> = throw UnsupportedOperationException()
fun <A> test(): Pair<Array<String>, Array<A>> = f()
@@ -0,0 +1,2 @@
<!-- typeParameterAsReified1 -->
Cannot use 'T' as reified type parameter. Use a class instead.
@@ -162,6 +162,12 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes
doTest(fileName);
}
@TestMetadata("typeParameterAsReified.kt")
public void testTypeParameterAsReified() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/diagnosticMessage/typeParameterAsReified.kt");
doTest(fileName);
}
@TestMetadata("unusedParameter.kt")
public void testUnusedParameter() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/diagnosticMessage/unusedParameter.kt");