KT-1056 Don't allow passing type arguments to T
#KT-1056 Fixed
This commit is contained in:
@@ -131,7 +131,10 @@ public class TypeResolver(
|
||||
scopeForTypeParameter)
|
||||
)
|
||||
|
||||
resolveTypeProjections(c, ErrorUtils.createErrorType("No type").getConstructor(), type.getTypeArguments())
|
||||
val arguments = resolveTypeProjections(c, ErrorUtils.createErrorType("No type").getConstructor(), type.getTypeArguments())
|
||||
if (!arguments.isEmpty()) {
|
||||
c.trace.report(WRONG_NUMBER_OF_TYPE_ARGUMENTS.on(type.getTypeArgumentList(), 0))
|
||||
}
|
||||
|
||||
val containing = classifierDescriptor.getContainingDeclaration()
|
||||
if (containing is ClassDescriptor) {
|
||||
|
||||
@@ -11,7 +11,7 @@ package foobar.a
|
||||
package foobar
|
||||
|
||||
abstract class Foo<T>() {
|
||||
abstract val x : T<Int>
|
||||
abstract val x : T<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><Int><!>
|
||||
}
|
||||
|
||||
// FILE: b.kt
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun <T> foo(t: T<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><String, Int><!>) {}
|
||||
|
||||
trait A
|
||||
class B<T: A>
|
||||
fun <T> foo1(t: T<!WRONG_NUMBER_OF_TYPE_ARGUMENTS!><B<<!UPPER_BOUND_VIOLATED!>String<!>>><!>) {}
|
||||
@@ -0,0 +1,17 @@
|
||||
package
|
||||
|
||||
internal fun </*0*/ T> foo(/*0*/ t: T): kotlin.Unit
|
||||
internal fun </*0*/ T> foo1(/*0*/ t: T): kotlin.Unit
|
||||
|
||||
internal trait A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
internal final class B</*0*/ T : A> {
|
||||
public constructor B</*0*/ T : A>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -4391,6 +4391,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/generics"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("argumentsForT.kt")
|
||||
public void testArgumentsForT() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/argumentsForT.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ClassObjectBoundsAreNotSupported.kt")
|
||||
public void testClassObjectBoundsAreNotSupported() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/generics/ClassObjectBoundsAreNotSupported.kt");
|
||||
|
||||
Reference in New Issue
Block a user