Propagate annotations when performing substitution on constructors #KT-7608 Fixed

Tests for deprecated warning on generic constructor.
This commit is contained in:
Ilya Ryzhenkov
2015-04-28 18:18:57 +03:00
parent 1fc742ffeb
commit 35e82d4574
4 changed files with 31 additions and 1 deletions
@@ -0,0 +1,8 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION, -REFLECTION_TYPES_NOT_LOADED, -UNUSED_PARAMETER
open class C<T>() {
deprecated("")
constructor(p: Int) : this(){}
}
class D : <!DEPRECATED_SYMBOL_WITH_MESSAGE!>C<String><!>(1)
@@ -0,0 +1,16 @@
package
internal open class C</*0*/ T> {
public constructor C</*0*/ T>()
kotlin.deprecated(value = "": kotlin.String) public constructor C</*0*/ T>(/*0*/ p: kotlin.Int)
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 D : C<kotlin.String> {
public constructor D()
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
}
@@ -3516,6 +3516,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("genericConstructorUsage.kt")
public void testGenericConstructorUsage() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deprecated/genericConstructorUsage.kt");
doTest(fileName);
}
@TestMetadata("imports.kt")
public void testImports() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/deprecated/imports.kt");
@@ -127,7 +127,7 @@ public class ConstructorDescriptorImpl extends FunctionDescriptorImpl implements
return new ConstructorDescriptorImpl(
(ClassDescriptor) newOwner,
this,
Annotations.EMPTY, // TODO
getAnnotations(),
isPrimary,
Kind.DECLARATION,
SourceElement.NO_SOURCE