[K/JS] Add @deprecated commentary if @Deprecated annotation exists on a declaration.
^KT-56405 Fixed
This commit is contained in:
Generated
+32
@@ -121,6 +121,38 @@ public class IrJsTypeScriptExportTestGenerated extends AbstractIrJsTypeScriptExp
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/deprecated")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Deprecated {
|
||||
@Test
|
||||
public void testAllFilesPresentInDeprecated() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/deprecated"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("deprecated.kt")
|
||||
public void testDeprecated() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/deprecated/deprecated.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/deprecated-in-exported-file")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Deprecated_in_exported_file {
|
||||
@Test
|
||||
public void testAllFilesPresentInDeprecated_in_exported_file() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/typescript-export/deprecated-in-exported-file"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("deprecated.kt")
|
||||
public void testDeprecated() throws Exception {
|
||||
runTest("js/js.translator/testData/typescript-export/deprecated-in-exported-file/deprecated.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/typescript-export/enum-classes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
/** @deprecated message 2 */
|
||||
const bar: string;
|
||||
/** @deprecated message 1 */
|
||||
function foo(): void;
|
||||
/** @deprecated message 3 */
|
||||
class TestClass {
|
||||
constructor();
|
||||
}
|
||||
class AnotherClass {
|
||||
/** @deprecated message 4 */
|
||||
constructor(value: string);
|
||||
get value(): string;
|
||||
/** @deprecated message 5 */
|
||||
static fromNothing(): foo.AnotherClass;
|
||||
static fromInt(value: number): foo.AnotherClass;
|
||||
/** @deprecated message 6 */
|
||||
foo(): void;
|
||||
baz(): void;
|
||||
/** @deprecated message 7 */
|
||||
get bar(): string;
|
||||
}
|
||||
interface TestInterface {
|
||||
/** @deprecated message 8 */
|
||||
foo(): void;
|
||||
bar(): void;
|
||||
/** @deprecated message 9 */
|
||||
readonly baz: string;
|
||||
readonly __doNotUseOrImplementIt: {
|
||||
readonly "foo.TestInterface": unique symbol;
|
||||
};
|
||||
}
|
||||
const TestObject: {
|
||||
/** @deprecated message 10 */
|
||||
foo(): void;
|
||||
bar(): void;
|
||||
/** @deprecated message 11 */
|
||||
get baz(): string;
|
||||
};
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/** This file is generated by {@link :js:js.test:generateJsExportOnFileTestFilesForTS} task. DO NOT MODIFY MANUALLY */
|
||||
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: deprecated.kt
|
||||
|
||||
@file:JsExport
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
@Deprecated("message 1")
|
||||
fun foo() {}
|
||||
|
||||
|
||||
@Deprecated("message 2")
|
||||
val bar: String = "Test"
|
||||
|
||||
|
||||
@Deprecated("message 3")
|
||||
class TestClass
|
||||
|
||||
|
||||
class AnotherClass @Deprecated("message 4") constructor(val value: String) {
|
||||
@JsName("fromNothing")
|
||||
@Deprecated("message 5") constructor(): this("Test")
|
||||
|
||||
@JsName("fromInt")
|
||||
constructor(value: Int): this(value.toString())
|
||||
|
||||
@Deprecated("message 6")
|
||||
fun foo() {}
|
||||
|
||||
fun baz() {}
|
||||
|
||||
@Deprecated("message 7")
|
||||
val bar: String = "Test"
|
||||
}
|
||||
|
||||
|
||||
interface TestInterface {
|
||||
@Deprecated("message 8")
|
||||
fun foo()
|
||||
fun bar()
|
||||
@Deprecated("message 9")
|
||||
val baz: String
|
||||
}
|
||||
|
||||
|
||||
object TestObject {
|
||||
@Deprecated("message 10")
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
@Deprecated("message 11")
|
||||
val baz: String = "Test"
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
var bar = JS_TESTS.foo.bar;
|
||||
var foo = JS_TESTS.foo.foo;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(bar == "Test");
|
||||
assert(foo() == undefined);
|
||||
return "OK";
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
import bar = JS_TESTS.foo.bar
|
||||
import foo = JS_TESTS.foo.foo
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
assert(bar == "Test");
|
||||
assert(foo() == undefined);
|
||||
|
||||
return "OK";
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
declare namespace JS_TESTS {
|
||||
type Nullable<T> = T | null | undefined
|
||||
namespace foo {
|
||||
/** @deprecated message 2 */
|
||||
const bar: string;
|
||||
/** @deprecated message 1 */
|
||||
function foo(): void;
|
||||
/** @deprecated message 3 */
|
||||
class TestClass {
|
||||
constructor();
|
||||
}
|
||||
class AnotherClass {
|
||||
/** @deprecated message 4 */
|
||||
constructor(value: string);
|
||||
get value(): string;
|
||||
/** @deprecated message 5 */
|
||||
static fromNothing(): foo.AnotherClass;
|
||||
static fromInt(value: number): foo.AnotherClass;
|
||||
/** @deprecated message 6 */
|
||||
foo(): void;
|
||||
baz(): void;
|
||||
/** @deprecated message 7 */
|
||||
get bar(): string;
|
||||
}
|
||||
interface TestInterface {
|
||||
/** @deprecated message 8 */
|
||||
foo(): void;
|
||||
bar(): void;
|
||||
/** @deprecated message 9 */
|
||||
readonly baz: string;
|
||||
readonly __doNotUseOrImplementIt: {
|
||||
readonly "foo.TestInterface": unique symbol;
|
||||
};
|
||||
}
|
||||
const TestObject: {
|
||||
/** @deprecated message 10 */
|
||||
foo(): void;
|
||||
bar(): void;
|
||||
/** @deprecated message 11 */
|
||||
get baz(): string;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// CHECK_TYPESCRIPT_DECLARATIONS
|
||||
// RUN_PLAIN_BOX_FUNCTION
|
||||
// SKIP_MINIFICATION
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// FILE: deprecated.kt
|
||||
|
||||
package foo
|
||||
|
||||
@JsExport
|
||||
@Deprecated("message 1")
|
||||
fun foo() {}
|
||||
|
||||
@JsExport
|
||||
@Deprecated("message 2")
|
||||
val bar: String = "Test"
|
||||
|
||||
@JsExport
|
||||
@Deprecated("message 3")
|
||||
class TestClass
|
||||
|
||||
@JsExport
|
||||
class AnotherClass @Deprecated("message 4") constructor(val value: String) {
|
||||
@JsName("fromNothing")
|
||||
@Deprecated("message 5") constructor(): this("Test")
|
||||
|
||||
@JsName("fromInt")
|
||||
constructor(value: Int): this(value.toString())
|
||||
|
||||
@Deprecated("message 6")
|
||||
fun foo() {}
|
||||
|
||||
fun baz() {}
|
||||
|
||||
@Deprecated("message 7")
|
||||
val bar: String = "Test"
|
||||
}
|
||||
|
||||
@JsExport
|
||||
interface TestInterface {
|
||||
@Deprecated("message 8")
|
||||
fun foo()
|
||||
fun bar()
|
||||
@Deprecated("message 9")
|
||||
val baz: String
|
||||
}
|
||||
|
||||
@JsExport
|
||||
object TestObject {
|
||||
@Deprecated("message 10")
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
@Deprecated("message 11")
|
||||
val baz: String = "Test"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
var bar = JS_TESTS.foo.bar;
|
||||
var foo = JS_TESTS.foo.foo;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
function box() {
|
||||
assert(bar == "Test");
|
||||
assert(foo() == undefined);
|
||||
return "OK";
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import bar = JS_TESTS.foo.bar
|
||||
import foo = JS_TESTS.foo.foo
|
||||
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
}
|
||||
}
|
||||
|
||||
function box(): string {
|
||||
assert(bar == "Test");
|
||||
assert(foo() == undefined);
|
||||
|
||||
return "OK";
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"include": [ "./*" ],
|
||||
"extends": "../common.tsconfig.json"
|
||||
}
|
||||
Reference in New Issue
Block a user