[K/JS] Add support of compilation with ES-classes
This commit is contained in:
@@ -145,6 +145,11 @@ class JsPrecedenceVisitor extends JsVisitor {
|
||||
answer = 17; // primary
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSuper(@NotNull JsSuperRef x) {
|
||||
answer = 17; // primary
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void visitElement(@NotNull JsNode node) {
|
||||
throw new RuntimeException("Only expressions have precedence.");
|
||||
|
||||
@@ -36,6 +36,9 @@ public class JsToStringGenerationVisitor extends JsVisitor {
|
||||
private static final char[] CHARS_FINALLY = "finally".toCharArray();
|
||||
private static final char[] CHARS_FOR = "for".toCharArray();
|
||||
private static final char[] CHARS_FUNCTION = "function".toCharArray();
|
||||
private static final char[] CHARS_STATIC = "static".toCharArray();
|
||||
private static final char[] CHARS_GET = "get".toCharArray();
|
||||
private static final char[] CHARS_SET = "set".toCharArray();
|
||||
private static final char[] CHARS_IF = "if".toCharArray();
|
||||
private static final char[] CHARS_IN = "in".toCharArray();
|
||||
private static final char[] CHARS_NEW = "new".toCharArray();
|
||||
@@ -43,6 +46,8 @@ public class JsToStringGenerationVisitor extends JsVisitor {
|
||||
private static final char[] CHARS_RETURN = "return".toCharArray();
|
||||
private static final char[] CHARS_SWITCH = "switch".toCharArray();
|
||||
private static final char[] CHARS_THIS = "this".toCharArray();
|
||||
|
||||
private static final char[] CHARS_SUPER = "super".toCharArray();
|
||||
private static final char[] CHARS_THROW = "throw".toCharArray();
|
||||
private static final char[] CHARS_TRUE = "true".toCharArray();
|
||||
private static final char[] CHARS_TRY = "try".toCharArray();
|
||||
@@ -664,8 +669,21 @@ public class JsToStringGenerationVisitor extends JsVisitor {
|
||||
printCommentsAfterNode(x);
|
||||
}
|
||||
|
||||
// name(<params>) { <body> }
|
||||
// [static?] [get|set?] name(<params>) { <body> }
|
||||
private void printFunction(@NotNull JsFunction x) {
|
||||
if (x.isStatic()) {
|
||||
p.print(CHARS_STATIC);
|
||||
space();
|
||||
}
|
||||
|
||||
if (x.isGetter()) {
|
||||
p.print(CHARS_GET);
|
||||
space();
|
||||
} else if (x.isSetter()) {
|
||||
p.print(CHARS_SET);
|
||||
space();
|
||||
}
|
||||
|
||||
if (x.getName() != null) {
|
||||
nameOf(x);
|
||||
}
|
||||
@@ -1128,6 +1146,17 @@ public class JsToStringGenerationVisitor extends JsVisitor {
|
||||
popSourceInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitSuper(@NotNull JsSuperRef x) {
|
||||
pushSourceInfo(x.getSource());
|
||||
printCommentsBeforeNode(x);
|
||||
|
||||
p.print(CHARS_SUPER);
|
||||
|
||||
printCommentsAfterNode(x);
|
||||
popSourceInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitThrow(@NotNull JsThrow x) {
|
||||
pushSourceInfo(x.getSource());
|
||||
|
||||
@@ -30,11 +30,14 @@ class JsClass(
|
||||
}
|
||||
|
||||
override fun acceptChildren(visitor: JsVisitor) {
|
||||
visitor.accept(baseClass)
|
||||
visitor.accept(constructor)
|
||||
visitor.acceptList(members)
|
||||
}
|
||||
|
||||
override fun traverse(v: JsVisitorWithContext, ctx: JsContext<*>) {
|
||||
if (v.visit(this, ctx)) {
|
||||
baseClass = v.accept(baseClass)
|
||||
constructor = v.accept(constructor)
|
||||
v.acceptList(members)
|
||||
}
|
||||
|
||||
@@ -10,15 +10,18 @@ import com.intellij.util.SmartList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public final class JsFunction extends JsLiteral implements HasName {
|
||||
public enum Modifier { STATIC, GET, SET }
|
||||
|
||||
@NotNull
|
||||
private JsBlock body;
|
||||
private List<JsParameter> params;
|
||||
@NotNull
|
||||
private final JsFunctionScope scope;
|
||||
private JsName name;
|
||||
private Set<Modifier> modifiers;
|
||||
|
||||
public JsFunction(@NotNull JsScope parentScope, @NotNull String description) {
|
||||
this(parentScope, description, null);
|
||||
@@ -29,7 +32,11 @@ public final class JsFunction extends JsLiteral implements HasName {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
private JsFunction(@NotNull JsScope parentScope, @NotNull String description, @Nullable JsName name) {
|
||||
private JsFunction(
|
||||
@NotNull JsScope parentScope,
|
||||
@NotNull String description,
|
||||
@Nullable JsName name
|
||||
) {
|
||||
this.name = name;
|
||||
scope = new JsFunctionScope(parentScope, name == null ? description : name.getIdent());
|
||||
}
|
||||
@@ -62,6 +69,26 @@ public final class JsFunction extends JsLiteral implements HasName {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public boolean isStatic() {
|
||||
return modifiers != null && modifiers.contains(Modifier.STATIC);
|
||||
}
|
||||
|
||||
public boolean isGetter() {
|
||||
return modifiers != null && modifiers.contains(Modifier.GET);
|
||||
}
|
||||
|
||||
public boolean isSetter() {
|
||||
return modifiers != null && modifiers.contains(Modifier.SET);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<Modifier> getModifiers() {
|
||||
if (modifiers == null) {
|
||||
modifiers = EnumSet.noneOf(Modifier.class);
|
||||
}
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
public void setBody(@NotNull JsBlock body) {
|
||||
this.body = body;
|
||||
}
|
||||
@@ -98,6 +125,7 @@ public final class JsFunction extends JsLiteral implements HasName {
|
||||
functionCopy.getScope().copyOwnNames(scope);
|
||||
functionCopy.setBody(body.deepCopy());
|
||||
functionCopy.params = AstUtil.deepCopy(params);
|
||||
functionCopy.modifiers = modifiers == null ? null : EnumSet.copyOf(modifiers);
|
||||
|
||||
return functionCopy.withMetadataFrom(this);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.backend.ast;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class JsSuperRef extends JsLiteral.JsValueLiteral {
|
||||
@Override
|
||||
public void accept(JsVisitor v) {
|
||||
v.visitSuper(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void traverse(JsVisitorWithContext v, JsContext ctx) {
|
||||
v.visit(this, ctx);
|
||||
v.endVisit(this, ctx);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JsSuperRef deepCopy() {
|
||||
return new JsSuperRef().withMetadataFrom(this);
|
||||
}
|
||||
}
|
||||
@@ -144,6 +144,9 @@ abstract class JsVisitor {
|
||||
open fun visitThis(x: JsThisRef): Unit =
|
||||
visitElement(x)
|
||||
|
||||
open fun visitSuper(x: JsSuperRef): Unit =
|
||||
visitElement(x)
|
||||
|
||||
open fun visitThrow(x: JsThrow): Unit =
|
||||
visitElement(x)
|
||||
|
||||
|
||||
@@ -199,6 +199,9 @@ public abstract class JsVisitorWithContext {
|
||||
endVisit((JsExpression) x, ctx);
|
||||
}
|
||||
|
||||
public void endVisit(@NotNull JsSuperRef x, @NotNull JsContext ctx) {
|
||||
endVisit((JsExpression) x, ctx);
|
||||
}
|
||||
public void endVisit(@NotNull JsThrow x, @NotNull JsContext ctx) {
|
||||
}
|
||||
|
||||
@@ -383,6 +386,9 @@ public abstract class JsVisitorWithContext {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean visit(@NotNull JsSuperRef x, @NotNull JsContext ctx) {
|
||||
return true;
|
||||
}
|
||||
public boolean visit(@NotNull JsThrow x, @NotNull JsContext ctx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -72,12 +72,17 @@ message Expression {
|
||||
PropertyReference property_reference = 40;
|
||||
Invocation invocation = 41;
|
||||
Instantiation instantiation = 42;
|
||||
SuperLiteral super_literal = 43;
|
||||
Class class = 44;
|
||||
}
|
||||
}
|
||||
|
||||
message ThisLiteral {
|
||||
}
|
||||
|
||||
message SuperLiteral {
|
||||
}
|
||||
|
||||
message NullLiteral {
|
||||
}
|
||||
|
||||
@@ -111,6 +116,20 @@ message Function {
|
||||
optional int32 name_id = 2;
|
||||
required Statement body = 3;
|
||||
optional bool local = 4 [default = false];
|
||||
repeated Modifier modifier = 5;
|
||||
|
||||
enum Modifier {
|
||||
STATIC = 1;
|
||||
GET = 2;
|
||||
SET = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message Class {
|
||||
optional int32 name_id = 1;
|
||||
optional Expression super_expression = 2;
|
||||
optional Function constructor = 3;
|
||||
repeated Function member = 4;
|
||||
}
|
||||
|
||||
message Parameter {
|
||||
|
||||
+30
-8
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.serialization.js.ast
|
||||
|
||||
import org.jetbrains.kotlin.js.backend.ast.*
|
||||
import org.jetbrains.kotlin.js.backend.ast.metadata.*
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.runIf
|
||||
import java.util.*
|
||||
|
||||
abstract class JsAstDeserializerBase {
|
||||
@@ -218,6 +219,7 @@ abstract class JsAstDeserializerBase {
|
||||
|
||||
protected fun deserializeNoMetadataHelper(proto: JsAstProtoBuf.Expression): JsExpression = when (proto.expressionCase) {
|
||||
JsAstProtoBuf.Expression.ExpressionCase.THIS_LITERAL -> JsThisRef()
|
||||
JsAstProtoBuf.Expression.ExpressionCase.SUPER_LITERAL -> JsSuperRef()
|
||||
JsAstProtoBuf.Expression.ExpressionCase.NULL_LITERAL -> JsNullLiteral()
|
||||
JsAstProtoBuf.Expression.ExpressionCase.TRUE_LITERAL -> JsBooleanLiteral(true)
|
||||
JsAstProtoBuf.Expression.ExpressionCase.FALSE_LITERAL -> JsBooleanLiteral(false)
|
||||
@@ -251,15 +253,18 @@ abstract class JsAstDeserializerBase {
|
||||
)
|
||||
}
|
||||
|
||||
JsAstProtoBuf.Expression.ExpressionCase.CLASS -> {
|
||||
val classProto = proto.class_
|
||||
JsClass(
|
||||
runIf(classProto.hasNameId()) { deserializeName(classProto.nameId) },
|
||||
runIf(classProto.hasSuperExpression()) { deserialize(classProto.superExpression) as JsNameRef },
|
||||
runIf(classProto.hasConstructor()) { deserializeFunction(classProto.constructor) },
|
||||
classProto.memberList.map(::deserializeFunction).toMutableList()
|
||||
)
|
||||
}
|
||||
|
||||
JsAstProtoBuf.Expression.ExpressionCase.FUNCTION -> {
|
||||
val functionProto = proto.function
|
||||
JsFunction(scope, deserialize(functionProto.body) as JsBlock, "").apply {
|
||||
parameters += functionProto.parameterList.map { deserializeParameter(it) }
|
||||
if (functionProto.hasNameId()) {
|
||||
name = deserializeName(functionProto.nameId)
|
||||
}
|
||||
isLocal = functionProto.local
|
||||
}
|
||||
deserializeFunction(proto.function)
|
||||
}
|
||||
|
||||
JsAstProtoBuf.Expression.ExpressionCase.DOC_COMMENT -> {
|
||||
@@ -345,6 +350,17 @@ abstract class JsAstDeserializerBase {
|
||||
JsAstProtoBuf.Expression.ExpressionCase.EXPRESSION_NOT_SET -> error("Unknown expression")
|
||||
}
|
||||
|
||||
protected fun deserializeFunction(functionProto: JsAstProtoBuf.Function): JsFunction {
|
||||
return JsFunction(scope, deserialize(functionProto.body) as JsBlock, "").apply {
|
||||
modifiers += functionProto.modifierList.map(::map)
|
||||
parameters += functionProto.parameterList.map { deserializeParameter(it) }
|
||||
if (functionProto.hasNameId()) {
|
||||
name = deserializeName(functionProto.nameId)
|
||||
}
|
||||
isLocal = functionProto.local
|
||||
}
|
||||
}
|
||||
|
||||
protected fun deserializeVars(proto: JsAstProtoBuf.Vars): JsVars {
|
||||
val vars = JsVars(proto.multiline)
|
||||
for (declProto in proto.declarationList) {
|
||||
@@ -406,6 +422,12 @@ abstract class JsAstDeserializerBase {
|
||||
|
||||
protected fun deserializeString(id: Int): String = stringTable[id]
|
||||
|
||||
protected fun map(modifier: JsAstProtoBuf.Function.Modifier) = when (modifier) {
|
||||
JsAstProtoBuf.Function.Modifier.STATIC -> JsFunction.Modifier.STATIC
|
||||
JsAstProtoBuf.Function.Modifier.SET -> JsFunction.Modifier.SET
|
||||
JsAstProtoBuf.Function.Modifier.GET -> JsFunction.Modifier.GET
|
||||
}
|
||||
|
||||
protected fun map(op: JsAstProtoBuf.BinaryOperation.Type) = when (op) {
|
||||
JsAstProtoBuf.BinaryOperation.Type.MUL -> JsBinaryOperator.MUL
|
||||
JsAstProtoBuf.BinaryOperation.Type.DIV -> JsBinaryOperator.DIV
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+33
-8
@@ -199,6 +199,10 @@ abstract class JsAstSerializerBase {
|
||||
builder.thisLiteral = JsAstProtoBuf.ThisLiteral.newBuilder().build()
|
||||
}
|
||||
|
||||
override fun visitSuper(x: JsSuperRef) {
|
||||
builder.superLiteral = JsAstProtoBuf.SuperLiteral.newBuilder().build()
|
||||
}
|
||||
|
||||
override fun visitNull(x: JsNullLiteral) {
|
||||
builder.nullLiteral = JsAstProtoBuf.NullLiteral.newBuilder().build()
|
||||
}
|
||||
@@ -249,14 +253,16 @@ abstract class JsAstSerializerBase {
|
||||
}
|
||||
|
||||
override fun visitFunction(x: JsFunction) {
|
||||
val functionBuilder = JsAstProtoBuf.Function.newBuilder()
|
||||
x.parameters.forEach { functionBuilder.addParameter(serializeParameter(it)) }
|
||||
x.name?.let { functionBuilder.nameId = serialize(it) }
|
||||
functionBuilder.body = serialize(x.body)
|
||||
if (x.isLocal) {
|
||||
functionBuilder.local = true
|
||||
}
|
||||
builder.function = functionBuilder.build()
|
||||
builder.function = serializeFunction(x)
|
||||
}
|
||||
|
||||
override fun visitClass(x: JsClass) {
|
||||
val classBuilder = JsAstProtoBuf.Class.newBuilder()
|
||||
x.name?.let { classBuilder.nameId = serialize(it) }
|
||||
x.baseClass?.let { classBuilder.superExpression = serialize(it) }
|
||||
x.constructor?.let { classBuilder.constructor = serializeFunction(it) }
|
||||
x.members.forEach { classBuilder.addMember(serializeFunction(it)) }
|
||||
builder.class_ = classBuilder.build()
|
||||
}
|
||||
|
||||
override fun visitDocComment(comment: JsDocComment) {
|
||||
@@ -392,6 +398,19 @@ abstract class JsAstSerializerBase {
|
||||
return blockBuilder.build()
|
||||
}
|
||||
|
||||
protected fun serializeFunction(function: JsFunction): JsAstProtoBuf.Function {
|
||||
val functionBuilder = JsAstProtoBuf.Function.newBuilder()
|
||||
function.parameters.forEach { functionBuilder.addParameter(serializeParameter(it)) }
|
||||
function.modifiers.forEach { functionBuilder.addModifier(map(it)) }
|
||||
function.name?.let { functionBuilder.nameId = serialize(it) }
|
||||
functionBuilder.body = serialize(function.body)
|
||||
if (function.isLocal) {
|
||||
functionBuilder.local = true
|
||||
}
|
||||
return functionBuilder.build()
|
||||
}
|
||||
|
||||
|
||||
protected fun serializeVars(vars: JsVars): JsAstProtoBuf.Vars {
|
||||
val varsBuilder = JsAstProtoBuf.Vars.newBuilder()
|
||||
for (varDecl in vars.vars) {
|
||||
@@ -419,6 +438,12 @@ abstract class JsAstSerializerBase {
|
||||
return unaryBuilder.build()
|
||||
}
|
||||
|
||||
protected fun map(modifier: JsFunction.Modifier) = when (modifier) {
|
||||
JsFunction.Modifier.STATIC -> JsAstProtoBuf.Function.Modifier.STATIC
|
||||
JsFunction.Modifier.SET -> JsAstProtoBuf.Function.Modifier.SET
|
||||
JsFunction.Modifier.GET -> JsAstProtoBuf.Function.Modifier.GET
|
||||
}
|
||||
|
||||
protected fun map(op: JsBinaryOperator) = when (op) {
|
||||
JsBinaryOperator.MUL -> JsAstProtoBuf.BinaryOperation.Type.MUL
|
||||
JsBinaryOperator.DIV -> JsAstProtoBuf.BinaryOperation.Type.DIV
|
||||
|
||||
@@ -613,7 +613,7 @@ class GenerateIrRuntime {
|
||||
|
||||
val transformer = IrModuleToJsTransformer(context, null)
|
||||
|
||||
return transformer.generateModule(listOf(module), setOf(TranslationMode.PER_MODULE), false)
|
||||
return transformer.generateModule(listOf(module), setOf(TranslationMode.PER_MODULE_DEV), false)
|
||||
}
|
||||
|
||||
fun compile(files: List<KtFile>): String {
|
||||
|
||||
@@ -8,6 +8,8 @@ package org.jetbrains.kotlin.generators.tests
|
||||
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
|
||||
import org.jetbrains.kotlin.generators.impl.generateTestGroupSuite
|
||||
import org.jetbrains.kotlin.incremental.AbstractInvalidationTest
|
||||
import org.jetbrains.kotlin.incremental.AbstractJsIrES6InvalidationTest
|
||||
import org.jetbrains.kotlin.incremental.AbstractJsIrInvalidationTest
|
||||
import org.jetbrains.kotlin.js.test.*
|
||||
import org.jetbrains.kotlin.js.test.fir.*
|
||||
import org.jetbrains.kotlin.js.test.ir.*
|
||||
@@ -66,9 +68,13 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testGroup("js/js.tests/tests-gen", "js/js.translator/testData") {
|
||||
testClass<AbstractInvalidationTest> {
|
||||
testClass<AbstractJsIrInvalidationTest> {
|
||||
model("incremental/invalidation/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR, recursive = false)
|
||||
}
|
||||
|
||||
testClass<AbstractJsIrES6InvalidationTest> {
|
||||
model("incremental/invalidation/", pattern = "^([^_](.+))$", targetBackend = TargetBackend.JS_IR_ES6, recursive = false)
|
||||
}
|
||||
}
|
||||
|
||||
testGroup("js/js.tests/tests-gen", "compiler/testData", testRunnerMethodName = "runTest0") {
|
||||
@@ -97,7 +103,7 @@ fun main(args: Array<String>) {
|
||||
generateTestGroupSuiteWithJUnit5(args) {
|
||||
testGroup("js/js.tests/tests-gen", "js/js.translator/testData", testRunnerMethodName = "runTest0") {
|
||||
testClass<AbstractBoxJsTest> {
|
||||
model("box/", pattern = "^([^_](.+))\\.kt$", excludeDirs = listOf("closure/inlineAnonymousFunctions"))
|
||||
model("box/", pattern = "^([^_](.+))\\.kt$", excludeDirs = listOf("closure/inlineAnonymousFunctions", "es6classes"))
|
||||
}
|
||||
|
||||
testClass<AbstractSourceMapGenerationSmokeTest> {
|
||||
@@ -121,6 +127,10 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractIrBoxJsTest> {
|
||||
model("box/", pattern = "^([^_](.+))\\.kt$", excludeDirs = listOf("es6classes"))
|
||||
}
|
||||
|
||||
testClass<AbstractIrBoxJsES6Test> {
|
||||
model("box/", pattern = "^([^_](.+))\\.kt$")
|
||||
}
|
||||
|
||||
@@ -133,7 +143,7 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
testClass<AbstractFirJsBoxTest> {
|
||||
model("box/", pattern = "^([^_](.+))\\.kt$")
|
||||
model("box/", pattern = "^([^_](.+))\\.kt$", excludeDirs = listOf("es6classes"))
|
||||
}
|
||||
|
||||
// see todo on defining class
|
||||
@@ -172,6 +182,18 @@ fun main(args: Array<String>) {
|
||||
model("codegen/boxInline")
|
||||
}
|
||||
|
||||
testClass<AbstractIrJsES6CodegenBoxTest> {
|
||||
model("codegen/box", excludeDirs = jvmOnlyBoxTests)
|
||||
}
|
||||
|
||||
testClass<AbstractIrJsES6CodegenBoxErrorTest> {
|
||||
model("codegen/boxError", excludeDirs = jvmOnlyBoxTests)
|
||||
}
|
||||
|
||||
testClass<AbstractIrJsES6CodegenInlineTest> {
|
||||
model("codegen/boxInline")
|
||||
}
|
||||
|
||||
testClass<AbstractIrCodegenWasmJsInteropJsTest> {
|
||||
model("codegen/boxWasmJsInterop")
|
||||
}
|
||||
|
||||
@@ -38,13 +38,20 @@ import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.serialization.js.ModuleKind
|
||||
import org.jetbrains.kotlin.test.builders.LanguageVersionSettingsBuilder
|
||||
import org.jetbrains.kotlin.test.KotlinTestWithEnvironment
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.test.util.JUnit4Assertions
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
|
||||
import org.junit.ComparisonFailure
|
||||
import java.io.File
|
||||
import java.util.EnumSet
|
||||
|
||||
abstract class AbstractInvalidationTest : KotlinTestWithEnvironment() {
|
||||
abstract class AbstractJsIrInvalidationTest : AbstractInvalidationTest(TargetBackend.JS_IR, "incrementalOut/invalidation")
|
||||
abstract class AbstractJsIrES6InvalidationTest : AbstractInvalidationTest(TargetBackend.JS_IR_ES6, "incrementalOut/invalidationES6")
|
||||
|
||||
abstract class AbstractInvalidationTest(
|
||||
private val targetBackend: TargetBackend,
|
||||
private val workingDirPath: String
|
||||
) : KotlinTestWithEnvironment() {
|
||||
companion object {
|
||||
private val OUT_DIR_PATH = System.getProperty("kotlin.js.test.root.out.dir") ?: error("'kotlin.js.test.root.out.dir' is not set")
|
||||
private val STDLIB_KLIB = File(System.getProperty("kotlin.js.stdlib.klib.path") ?: error("Please set stdlib path")).canonicalPath
|
||||
@@ -297,7 +304,13 @@ abstract class AbstractInvalidationTest : KotlinTestWithEnvironment() {
|
||||
irFactory = { IrFactoryImplForJsIC(WholeWorldStageController()) },
|
||||
mainArguments = null,
|
||||
compilerInterfaceFactory = { mainModule, cfg ->
|
||||
JsIrCompilerWithIC(mainModule, cfg, JsGenerationGranularity.PER_MODULE, setOf(FqName(BOX_FUNCTION_NAME)))
|
||||
JsIrCompilerWithIC(
|
||||
mainModule,
|
||||
cfg,
|
||||
JsGenerationGranularity.PER_MODULE,
|
||||
setOf(FqName(BOX_FUNCTION_NAME)),
|
||||
targetBackend == TargetBackend.JS_IR_ES6
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -418,7 +431,7 @@ abstract class AbstractInvalidationTest : KotlinTestWithEnvironment() {
|
||||
}
|
||||
|
||||
private fun testWorkingDir(testName: String): File {
|
||||
val dir = File(File(File(OUT_DIR_PATH), "incrementalOut/invalidation"), testName)
|
||||
val dir = File(File(File(OUT_DIR_PATH), workingDirPath), testName)
|
||||
|
||||
dir.invalidateDir()
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ class JsIrBackendFacade(
|
||||
val splitPerFile = JsEnvironmentConfigurationDirectives.SPLIT_PER_FILE in module.directives
|
||||
val perModule = JsEnvironmentConfigurationDirectives.PER_MODULE in module.directives
|
||||
val keep = module.directives[JsEnvironmentConfigurationDirectives.KEEP].toSet()
|
||||
val es6Mode = JsEnvironmentConfigurationDirectives.ES6_MODE in module.directives
|
||||
|
||||
val granularity = when {
|
||||
!firstTimeCompilation -> JsGenerationGranularity.WHOLE_PROGRAM
|
||||
@@ -98,7 +99,7 @@ class JsIrBackendFacade(
|
||||
}
|
||||
|
||||
val compiledModule = CompilerResult(
|
||||
outputs = listOf(TranslationMode.FULL, TranslationMode.PER_MODULE).associateWith {
|
||||
outputs = listOf(TranslationMode.FULL_DEV, TranslationMode.PER_MODULE_DEV).associateWith {
|
||||
val jsExecutableProducer = JsExecutableProducer(
|
||||
mainModuleName = configuration.getNotNull(CommonConfigurationKeys.MODULE_NAME),
|
||||
moduleKind = configuration.get(JSConfigurationKeys.MODULE_KIND, ModuleKind.PLAIN),
|
||||
@@ -143,7 +144,7 @@ class JsIrBackendFacade(
|
||||
exportedDeclarations = setOf(FqName.fromSegments(listOfNotNull(testPackage, TEST_FUNCTION))),
|
||||
keep = keep,
|
||||
dceRuntimeDiagnostic = null,
|
||||
es6mode = false,
|
||||
es6mode = es6Mode,
|
||||
safeExternalBoolean = JsEnvironmentConfigurationDirectives.SAFE_EXTERNAL_BOOLEAN in module.directives,
|
||||
safeExternalBooleanDiagnostic = module.directives[JsEnvironmentConfigurationDirectives.SAFE_EXTERNAL_BOOLEAN_DIAGNOSTIC].singleOrNull(),
|
||||
granularity = granularity,
|
||||
@@ -166,7 +167,7 @@ class JsIrBackendFacade(
|
||||
module.directives[JsEnvironmentConfigurationDirectives.MODULE_KIND].contains(ModuleKind.ES)
|
||||
|
||||
val outputFile =
|
||||
File(JsEnvironmentConfigurator.getJsModuleArtifactPath(testServices, module.name, TranslationMode.FULL) + module.kind.extension)
|
||||
File(JsEnvironmentConfigurator.getJsModuleArtifactPath(testServices, module.name, TranslationMode.FULL_DEV) + module.kind.extension)
|
||||
|
||||
val transformer = IrModuleToJsTransformer(
|
||||
loweredIr.context,
|
||||
@@ -180,8 +181,8 @@ class JsIrBackendFacade(
|
||||
// If perModuleOnly then skip whole program
|
||||
// (it.dce => runIrDce) && (perModuleOnly => it.perModule)
|
||||
val translationModes = TranslationMode.values()
|
||||
.filter { (it.dce || !onlyIrDce) && (!it.dce || runIrDce) && (!perModuleOnly || it.perModule) }
|
||||
.filter { it.dce == it.minimizedMemberNames }
|
||||
.filter { (it.production || !onlyIrDce) && (!it.production || runIrDce) && (!perModuleOnly || it.perModule) }
|
||||
.filter { it.production == it.minimizedMemberNames }
|
||||
.toSet()
|
||||
val compilationOut = transformer.generateModule(loweredIr.allModules, translationModes, false)
|
||||
return BinaryArtifacts.Js.JsIrArtifact(outputFile, compilationOut).dump(module)
|
||||
|
||||
@@ -39,9 +39,9 @@ class JsArtifactsDumpHandler(testServices: TestServices) : AfterAnalysisChecker(
|
||||
val minOutputDir = File(dceOutputDir, originalFile.nameWithoutExtension)
|
||||
|
||||
copy(JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices), outputDir)
|
||||
copy(JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices, TranslationMode.FULL_DCE_MINIMIZED_NAMES), dceOutputDir)
|
||||
copy(JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices, TranslationMode.PER_MODULE), perModuleOutputDir)
|
||||
copy(JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices, TranslationMode.PER_MODULE_DCE_MINIMIZED_NAMES), preModuleDceOutputDir)
|
||||
copy(JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices, TranslationMode.FULL_PROD_MINIMIZED_NAMES), dceOutputDir)
|
||||
copy(JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices, TranslationMode.PER_MODULE_DEV), perModuleOutputDir)
|
||||
copy(JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices, TranslationMode.PER_MODULE_PROD_MINIMIZED_NAMES), preModuleDceOutputDir)
|
||||
copy(JsEnvironmentConfigurator.getMinificationJsArtifactsOutputDir(testServices), minOutputDir)
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class JsAstHandler(testServices: TestServices) : JsBinaryArtifactHandler(testSer
|
||||
val ktFiles = module.files.filter { it.isKtFile }.map { it.originalContent }
|
||||
val jsProgram = when (val artifact = info.unwrap()) {
|
||||
is BinaryArtifacts.Js.OldJsArtifact -> (artifact.translationResult as TranslationResult.Success).program
|
||||
is BinaryArtifacts.Js.JsIrArtifact -> artifact.compilerResult.outputs[TranslationMode.FULL]?.jsProgram ?: return
|
||||
is BinaryArtifacts.Js.JsIrArtifact -> artifact.compilerResult.outputs[TranslationMode.FULL_DEV]?.jsProgram ?: return
|
||||
else -> return
|
||||
}
|
||||
processJsProgram(jsProgram, ktFiles, module.targetBackend!!)
|
||||
|
||||
@@ -60,7 +60,7 @@ class JsDebugRunner(testServices: TestServices, private val localVariables: Bool
|
||||
if (esModules) return
|
||||
|
||||
// This file generated in the FULL mode should be self-sufficient.
|
||||
val jsFilePath = getAllFilesForRunner(testServices, modulesToArtifact)[TranslationMode.FULL]?.single()
|
||||
val jsFilePath = getAllFilesForRunner(testServices, modulesToArtifact)[TranslationMode.FULL_DEV]?.single()
|
||||
?: error("Only FULL translation mode is supported")
|
||||
|
||||
val mainModule = JsEnvironmentConfigurator.getMainModule(testServices)
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ class JsIrRecompiledArtifactsIdentityHandler(testServices: TestServices) : JsBin
|
||||
}
|
||||
|
||||
private fun Js.JsIrArtifact.allFiles(): Collection<File> {
|
||||
return listOf(outputFile) + compilerResult.outputs[TranslationMode.FULL]!!.dependencies.map { (moduleId, _) ->
|
||||
return listOf(outputFile) + compilerResult.outputs[TranslationMode.FULL_DEV]!!.dependencies.map { (moduleId, _) ->
|
||||
outputFile.augmentWithModuleName(moduleId)
|
||||
}.sortedBy { it.name }
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ import java.io.File
|
||||
*/
|
||||
class JsLineNumberHandler(testServices: TestServices) : JsBinaryArtifactHandler(testServices) {
|
||||
|
||||
private val translationModeForIr = TranslationMode.PER_MODULE
|
||||
private val translationModeForIr = TranslationMode.PER_MODULE_DEV
|
||||
|
||||
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {}
|
||||
|
||||
override fun processModule(module: TestModule, info: BinaryArtifacts.Js) {
|
||||
when (val artifact = info.unwrap()) {
|
||||
is BinaryArtifacts.Js.OldJsArtifact ->
|
||||
verifyModule(module, TranslationMode.FULL, artifact.translationResult.cast<TranslationResult.Success>().program, "JS")
|
||||
verifyModule(module, TranslationMode.FULL_DEV, artifact.translationResult.cast<TranslationResult.Success>().program, "JS")
|
||||
is BinaryArtifacts.Js.JsIrArtifact -> {
|
||||
val testModules = testServices.moduleStructure.modules
|
||||
val moduleId2TestModule = testModules.associateBy { it.name.safeModuleName }
|
||||
|
||||
@@ -23,10 +23,10 @@ class JsSourceMapPathRewriter(testServices: TestServices) : AbstractJsArtifactsC
|
||||
|
||||
override fun processAfterAllModules(someAssertionWasFailed: Boolean) {
|
||||
val supportedTranslationModes = arrayOf(
|
||||
TranslationMode.FULL,
|
||||
TranslationMode.FULL_DCE_MINIMIZED_NAMES,
|
||||
TranslationMode.PER_MODULE,
|
||||
TranslationMode.PER_MODULE_DCE_MINIMIZED_NAMES,
|
||||
TranslationMode.FULL_DEV,
|
||||
TranslationMode.FULL_PROD_MINIMIZED_NAMES,
|
||||
TranslationMode.PER_MODULE_DEV,
|
||||
TranslationMode.PER_MODULE_PROD_MINIMIZED_NAMES,
|
||||
)
|
||||
val testModules = testServices.moduleStructure.modules
|
||||
val allTestFiles = testModules.flatMap { it.files }
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.ir
|
||||
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
|
||||
import org.jetbrains.kotlin.test.directives.JsEnvironmentConfigurationDirectives
|
||||
import org.jetbrains.kotlin.test.services.configuration.JsEnvironmentConfigurator
|
||||
|
||||
abstract class AbstractJsIrES6Test(
|
||||
pathToTestDir: String,
|
||||
testGroupOutputDirPrefix: String,
|
||||
) : AbstractJsIrTest(pathToTestDir, testGroupOutputDirPrefix, TargetBackend.JS_IR_ES6) {
|
||||
override fun configure(builder: TestConfigurationBuilder) {
|
||||
super.configure(builder)
|
||||
with(builder) {
|
||||
defaultDirectives {
|
||||
+JsEnvironmentConfigurationDirectives.ES6_MODE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class AbstractIrBoxJsES6Test : AbstractJsIrES6Test(
|
||||
pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/box/",
|
||||
testGroupOutputDirPrefix = "irEs6Box/"
|
||||
)
|
||||
|
||||
open class AbstractIrJsES6CodegenBoxTest : AbstractJsIrES6Test(
|
||||
pathToTestDir = "compiler/testData/codegen/box/",
|
||||
testGroupOutputDirPrefix = "codegen/irEs6Box/"
|
||||
)
|
||||
|
||||
open class AbstractIrJsES6CodegenBoxErrorTest : AbstractJsIrES6Test(
|
||||
pathToTestDir = "compiler/testData/codegen/boxError/",
|
||||
testGroupOutputDirPrefix = "codegen/irEs6BoxError/"
|
||||
)
|
||||
|
||||
open class AbstractIrJsES6CodegenInlineTest : AbstractJsIrES6Test(
|
||||
pathToTestDir = "compiler/testData/codegen/boxInline/",
|
||||
testGroupOutputDirPrefix = "codegen/irEs6BoxInline/"
|
||||
)
|
||||
@@ -29,8 +29,9 @@ import java.lang.Boolean.getBoolean
|
||||
abstract class AbstractJsIrTest(
|
||||
pathToTestDir: String,
|
||||
testGroupOutputDirPrefix: String,
|
||||
targetBackend: TargetBackend = TargetBackend.JS_IR
|
||||
) : AbstractJsBlackBoxCodegenTestBase<ClassicFrontendOutputArtifact, IrBackendInput, BinaryArtifacts.KLib>(
|
||||
FrontendKinds.ClassicFrontend, TargetBackend.JS_IR, pathToTestDir, testGroupOutputDirPrefix, skipMinification = true
|
||||
FrontendKinds.ClassicFrontend, targetBackend, pathToTestDir, testGroupOutputDirPrefix, skipMinification = true
|
||||
) {
|
||||
override val frontendFacade: Constructor<FrontendFacade<ClassicFrontendOutputArtifact>>
|
||||
get() = ::ClassicFrontendFacade
|
||||
|
||||
@@ -237,11 +237,11 @@ abstract class AbstractJsKLibABITestCase : KtUsefulTestCase() {
|
||||
|
||||
val compiledResult = transformer.generateModule(
|
||||
modules = ir.allModules,
|
||||
modes = setOf(TranslationMode.PER_MODULE),
|
||||
modes = setOf(TranslationMode.PER_MODULE_DEV),
|
||||
relativeRequirePath = false
|
||||
)
|
||||
|
||||
return compiledResult.outputs[TranslationMode.PER_MODULE] ?: error("No compiler output")
|
||||
return compiledResult.outputs[TranslationMode.PER_MODULE_DEV] ?: error("No compiler output")
|
||||
}
|
||||
|
||||
private fun KotlinCoreEnvironment.createPsiFiles(sourceDir: File): List<KtFile> {
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.konan.properties.propertyList
|
||||
import org.jetbrains.kotlin.library.KLIB_PROPERTY_DEPENDS
|
||||
import org.jetbrains.kotlin.library.KotlinLibrary
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
import org.jetbrains.kotlin.test.directives.JsEnvironmentConfigurationDirectives
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestService
|
||||
@@ -89,7 +90,7 @@ class JsIrIncrementalDataProvider(private val testServices: TestServices) : Test
|
||||
.run { if (shouldBeGenerated()) arguments() else null }
|
||||
|
||||
runtimeKlibPath.forEach {
|
||||
recordIncrementalData(it, null, libs, configuration, mainArguments)
|
||||
recordIncrementalData(it, null, libs, configuration, mainArguments, module.targetBackend)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +105,15 @@ class JsIrIncrementalDataProvider(private val testServices: TestServices) : Test
|
||||
.run { if (shouldBeGenerated()) arguments() else null }
|
||||
|
||||
val allDependencies = JsEnvironmentConfigurator.getAllRecursiveLibrariesFor(module, testServices).keys.toList()
|
||||
recordIncrementalData(path, dirtyFiles, allDependencies + library, configuration, mainArguments)
|
||||
|
||||
recordIncrementalData(
|
||||
path,
|
||||
dirtyFiles,
|
||||
allDependencies + library,
|
||||
configuration,
|
||||
mainArguments,
|
||||
module.targetBackend
|
||||
)
|
||||
}
|
||||
|
||||
private fun recordIncrementalData(
|
||||
@@ -112,7 +121,8 @@ class JsIrIncrementalDataProvider(private val testServices: TestServices) : Test
|
||||
dirtyFiles: List<String>?,
|
||||
allDependencies: List<KotlinLibrary>,
|
||||
configuration: CompilerConfiguration,
|
||||
mainArguments: List<String>?
|
||||
mainArguments: List<String>?,
|
||||
targetBackend: TargetBackend?
|
||||
) {
|
||||
val canonicalPath = File(path).canonicalPath
|
||||
val predefinedModuleCache = predefinedKlibHasIcCache[canonicalPath]
|
||||
@@ -143,6 +153,7 @@ class JsIrIncrementalDataProvider(private val testServices: TestServices) : Test
|
||||
IrFactoryImplForJsIC(WholeWorldStageController()),
|
||||
setOf(FqName.fromSegments(listOfNotNull(testPackage, JsBoxRunner.TEST_FUNCTION))),
|
||||
mainArguments,
|
||||
targetBackend == TargetBackend.JS_IR_ES6
|
||||
)
|
||||
|
||||
val moduleCache = icCache[canonicalPath] ?: TestArtifactCache(mainModuleIr.name.asString())
|
||||
|
||||
@@ -42,7 +42,7 @@ fun TestModule.getNameFor(file: TestFile, testServices: TestServices): String {
|
||||
private fun extractJsFiles(
|
||||
testServices: TestServices,
|
||||
modules: List<TestModule>,
|
||||
mode: TranslationMode = TranslationMode.FULL,
|
||||
mode: TranslationMode = TranslationMode.FULL_DEV,
|
||||
): Pair<List<String>, List<String>> {
|
||||
val outputDir = JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices, mode)
|
||||
|
||||
@@ -67,13 +67,13 @@ private fun extractJsFiles(
|
||||
return before to after
|
||||
}
|
||||
|
||||
fun getAdditionalFilePathes(testServices: TestServices, mode: TranslationMode = TranslationMode.FULL): List<String> {
|
||||
fun getAdditionalFilePathes(testServices: TestServices, mode: TranslationMode = TranslationMode.FULL_DEV): List<String> {
|
||||
return getAdditionalFiles(testServices, mode, true).map { it.absolutePath }
|
||||
}
|
||||
|
||||
fun getAdditionalFiles(
|
||||
testServices: TestServices,
|
||||
mode: TranslationMode = TranslationMode.FULL,
|
||||
mode: TranslationMode = TranslationMode.FULL_DEV,
|
||||
shouldCopyFiles: Boolean = false
|
||||
): List<File> {
|
||||
val originalFile = testServices.moduleStructure.originalTestDataFiles.first()
|
||||
@@ -99,13 +99,13 @@ fun getAdditionalFiles(
|
||||
return additionalFiles
|
||||
}
|
||||
|
||||
fun getAdditionalMainFilePathes(testServices: TestServices, mode: TranslationMode = TranslationMode.FULL): List<String> {
|
||||
fun getAdditionalMainFilePathes(testServices: TestServices, mode: TranslationMode = TranslationMode.FULL_DEV): List<String> {
|
||||
return getAdditionalMainFiles(testServices, mode, shouldCopyFiles = true).map { it.absolutePath }
|
||||
}
|
||||
|
||||
fun getAdditionalMainFiles(
|
||||
testServices: TestServices,
|
||||
mode: TranslationMode = TranslationMode.FULL,
|
||||
mode: TranslationMode = TranslationMode.FULL_DEV,
|
||||
shouldCopyFiles: Boolean = false
|
||||
): List<File> {
|
||||
val originalFile = testServices.moduleStructure.originalTestDataFiles.first()
|
||||
@@ -174,7 +174,7 @@ fun getAllFilesForRunner(
|
||||
val additionalMainFiles = getAdditionalMainFilePathes(testServices)
|
||||
// Old BE
|
||||
val outputDir = JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices)
|
||||
val dceOutputDir = JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices, TranslationMode.FULL_DCE_MINIMIZED_NAMES)
|
||||
val dceOutputDir = JsEnvironmentConfigurator.getJsArtifactsOutputDir(testServices, TranslationMode.FULL_PROD_MINIMIZED_NAMES)
|
||||
|
||||
val artifactsPaths = modulesToArtifact.values.map { it.outputFile.absolutePath }.filter { !File(it).isDirectory }
|
||||
val allJsFiles = additionalFiles + inputJsFilesBefore + artifactsPaths + commonFiles + additionalMainFiles + inputJsFilesAfter
|
||||
@@ -185,12 +185,12 @@ fun getAllFilesForRunner(
|
||||
val runIrDce = JsEnvironmentConfigurationDirectives.RUN_IR_DCE in globalDirectives
|
||||
val onlyIrDce = JsEnvironmentConfigurationDirectives.ONLY_IR_DCE in globalDirectives
|
||||
if (!onlyIrDce) {
|
||||
result[TranslationMode.FULL] = allJsFiles
|
||||
result[TranslationMode.FULL_DEV] = allJsFiles
|
||||
}
|
||||
if (runIrDce) {
|
||||
val dceJsFiles = artifactsPaths.map { it.replace(outputDir.absolutePath, dceOutputDir.absolutePath) }
|
||||
val dceAllJsFiles = additionalFiles + inputJsFilesBefore + dceJsFiles + commonFiles + additionalMainFiles + inputJsFilesAfter
|
||||
result[TranslationMode.FULL_DCE_MINIMIZED_NAMES] = dceAllJsFiles
|
||||
result[TranslationMode.FULL_PROD_MINIMIZED_NAMES] = dceAllJsFiles
|
||||
}
|
||||
|
||||
return result
|
||||
@@ -199,7 +199,7 @@ fun getAllFilesForRunner(
|
||||
|
||||
fun getOnlyJsFilesForRunner(testServices: TestServices, modulesToArtifact: Map<TestModule, BinaryArtifacts.Js>): List<String> {
|
||||
return getAllFilesForRunner(testServices, modulesToArtifact).let {
|
||||
it[TranslationMode.FULL] ?: it[TranslationMode.PER_MODULE]!!
|
||||
it[TranslationMode.FULL_DEV] ?: it[TranslationMode.PER_MODULE_DEV]!!
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Generated
+377
@@ -0,0 +1,377 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.incremental;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("js/js.translator/testData/incremental/invalidation")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class JsIrES6InvalidationTestGenerated extends AbstractJsIrES6InvalidationTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("addUpdateRemoveDependentFile")
|
||||
public void testAddUpdateRemoveDependentFile() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/addUpdateRemoveDependentFile/");
|
||||
}
|
||||
|
||||
@TestMetadata("addUpdateRemoveDependentModule")
|
||||
public void testAddUpdateRemoveDependentModule() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/addUpdateRemoveDependentModule/");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInInvalidation() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/incremental/invalidation"), Pattern.compile("^([^_](.+))$"), null, TargetBackend.JS_IR_ES6, false);
|
||||
}
|
||||
|
||||
@TestMetadata("circleExportsUpdate")
|
||||
public void testCircleExportsUpdate() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/circleExportsUpdate/");
|
||||
}
|
||||
|
||||
@TestMetadata("circleInlineImportsUpdate")
|
||||
public void testCircleInlineImportsUpdate() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/circleInlineImportsUpdate/");
|
||||
}
|
||||
|
||||
@TestMetadata("class")
|
||||
public void testClass() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/class/");
|
||||
}
|
||||
|
||||
@TestMetadata("classFunctionsAndFields")
|
||||
public void testClassFunctionsAndFields() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/classFunctionsAndFields/");
|
||||
}
|
||||
|
||||
@TestMetadata("companionFunction")
|
||||
public void testCompanionFunction() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/companionFunction/");
|
||||
}
|
||||
|
||||
@TestMetadata("companionInlineFunction")
|
||||
public void testCompanionInlineFunction() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/companionInlineFunction/");
|
||||
}
|
||||
|
||||
@TestMetadata("companionProperties")
|
||||
public void testCompanionProperties() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/companionProperties/");
|
||||
}
|
||||
|
||||
@TestMetadata("companionWithStdLibCall")
|
||||
public void testCompanionWithStdLibCall() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/companionWithStdLibCall/");
|
||||
}
|
||||
|
||||
@TestMetadata("constVals")
|
||||
public void testConstVals() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/constVals/");
|
||||
}
|
||||
|
||||
@TestMetadata("crossModuleReferences")
|
||||
public void testCrossModuleReferences() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/crossModuleReferences/");
|
||||
}
|
||||
|
||||
@TestMetadata("eagerInitialization")
|
||||
public void testEagerInitialization() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/eagerInitialization/");
|
||||
}
|
||||
|
||||
@TestMetadata("enum")
|
||||
public void testEnum() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/enum/");
|
||||
}
|
||||
|
||||
@TestMetadata("enumsInInlineFunctions")
|
||||
public void testEnumsInInlineFunctions() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/enumsInInlineFunctions/");
|
||||
}
|
||||
|
||||
@TestMetadata("exceptionsFromInlineFunction")
|
||||
public void testExceptionsFromInlineFunction() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/exceptionsFromInlineFunction/");
|
||||
}
|
||||
|
||||
@TestMetadata("exportsThroughInlineFunction")
|
||||
public void testExportsThroughInlineFunction() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/exportsThroughInlineFunction/");
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideClassFunctionQualifiers")
|
||||
public void testFakeOverrideClassFunctionQualifiers() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/fakeOverrideClassFunctionQualifiers/");
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideInheritance")
|
||||
public void testFakeOverrideInheritance() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/fakeOverrideInheritance/");
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideInlineExtension")
|
||||
public void testFakeOverrideInlineExtension() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/fakeOverrideInlineExtension/");
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideInlineFunction")
|
||||
public void testFakeOverrideInlineFunction() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/fakeOverrideInlineFunction/");
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideInlineProperty")
|
||||
public void testFakeOverrideInlineProperty() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/fakeOverrideInlineProperty/");
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideInterfaceFunctionQualifiers")
|
||||
public void testFakeOverrideInterfaceFunctionQualifiers() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/fakeOverrideInterfaceFunctionQualifiers/");
|
||||
}
|
||||
|
||||
@TestMetadata("fastPath1")
|
||||
public void testFastPath1() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/fastPath1/");
|
||||
}
|
||||
|
||||
@TestMetadata("fastPath2")
|
||||
public void testFastPath2() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/fastPath2/");
|
||||
}
|
||||
|
||||
@TestMetadata("friendDependency")
|
||||
public void testFriendDependency() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/friendDependency/");
|
||||
}
|
||||
|
||||
@TestMetadata("functionDefaultParams")
|
||||
public void testFunctionDefaultParams() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/functionDefaultParams/");
|
||||
}
|
||||
|
||||
@TestMetadata("functionSignature")
|
||||
public void testFunctionSignature() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/functionSignature/");
|
||||
}
|
||||
|
||||
@TestMetadata("genericFunctions")
|
||||
public void testGenericFunctions() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/genericFunctions/");
|
||||
}
|
||||
|
||||
@TestMetadata("genericInlineFunctions")
|
||||
public void testGenericInlineFunctions() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/genericInlineFunctions/");
|
||||
}
|
||||
|
||||
@TestMetadata("gettersAndSettersInlining")
|
||||
public void testGettersAndSettersInlining() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/gettersAndSettersInlining/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineBecomeNonInline")
|
||||
public void testInlineBecomeNonInline() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/inlineBecomeNonInline/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionAnnotations")
|
||||
public void testInlineFunctionAnnotations() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/inlineFunctionAnnotations/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionAsFunctionReference")
|
||||
public void testInlineFunctionAsFunctionReference() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/inlineFunctionAsFunctionReference/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionAsParam")
|
||||
public void testInlineFunctionAsParam() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/inlineFunctionAsParam/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionCircleUsage")
|
||||
public void testInlineFunctionCircleUsage() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/inlineFunctionCircleUsage/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionDefaultParams")
|
||||
public void testInlineFunctionDefaultParams() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/inlineFunctionDefaultParams/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunctionWithObject")
|
||||
public void testInlineFunctionWithObject() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/inlineFunctionWithObject/");
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceSuperUsage")
|
||||
public void testInterfaceSuperUsage() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/interfaceSuperUsage/");
|
||||
}
|
||||
|
||||
@TestMetadata("interfaceWithDefaultParams")
|
||||
public void testInterfaceWithDefaultParams() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/interfaceWithDefaultParams/");
|
||||
}
|
||||
|
||||
@TestMetadata("jsCode")
|
||||
public void testJsCode() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/jsCode/");
|
||||
}
|
||||
|
||||
@TestMetadata("jsExport")
|
||||
public void testJsExport() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/jsExport/");
|
||||
}
|
||||
|
||||
@TestMetadata("jsModuleAnnotation")
|
||||
public void testJsModuleAnnotation() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/jsModuleAnnotation/");
|
||||
}
|
||||
|
||||
@TestMetadata("localInlineFunction")
|
||||
public void testLocalInlineFunction() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/localInlineFunction/");
|
||||
}
|
||||
|
||||
@TestMetadata("mainModuleInvalidation")
|
||||
public void testMainModuleInvalidation() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/mainModuleInvalidation/");
|
||||
}
|
||||
|
||||
@TestMetadata("moveAndModifyInlineFunction")
|
||||
public void testMoveAndModifyInlineFunction() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/moveAndModifyInlineFunction/");
|
||||
}
|
||||
|
||||
@TestMetadata("moveExternalDeclarationsBetweenJsModules")
|
||||
public void testMoveExternalDeclarationsBetweenJsModules() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/moveExternalDeclarationsBetweenJsModules/");
|
||||
}
|
||||
|
||||
@TestMetadata("moveFilesBetweenModules")
|
||||
public void testMoveFilesBetweenModules() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/moveFilesBetweenModules/");
|
||||
}
|
||||
|
||||
@TestMetadata("moveInlineFunctionBetweenModules")
|
||||
public void testMoveInlineFunctionBetweenModules() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/moveInlineFunctionBetweenModules/");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedClass")
|
||||
public void testNestedClass() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/nestedClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("nonInlineBecomeInline")
|
||||
public void testNonInlineBecomeInline() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/nonInlineBecomeInline/");
|
||||
}
|
||||
|
||||
@TestMetadata("privateDeclarationLeakThroughDefaultParam")
|
||||
public void testPrivateDeclarationLeakThroughDefaultParam() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/privateDeclarationLeakThroughDefaultParam/");
|
||||
}
|
||||
|
||||
@TestMetadata("privateInlineFunction1")
|
||||
public void testPrivateInlineFunction1() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/privateInlineFunction1/");
|
||||
}
|
||||
|
||||
@TestMetadata("removeFile")
|
||||
public void testRemoveFile() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/removeFile/");
|
||||
}
|
||||
|
||||
@TestMetadata("removeModule")
|
||||
public void testRemoveModule() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/removeModule/");
|
||||
}
|
||||
|
||||
@TestMetadata("removeUnusedFile")
|
||||
public void testRemoveUnusedFile() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/removeUnusedFile/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFile")
|
||||
public void testRenameFile() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/renameFile/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameModule")
|
||||
public void testRenameModule() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/renameModule/");
|
||||
}
|
||||
|
||||
@TestMetadata("simple")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/simple/");
|
||||
}
|
||||
|
||||
@TestMetadata("splitJoinModule")
|
||||
public void testSplitJoinModule() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/splitJoinModule/");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendFunctions")
|
||||
public void testSuspendFunctions() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/suspendFunctions/");
|
||||
}
|
||||
|
||||
@TestMetadata("suspendInterfaceWithDefaultParams")
|
||||
public void testSuspendInterfaceWithDefaultParams() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/suspendInterfaceWithDefaultParams/");
|
||||
}
|
||||
|
||||
@TestMetadata("toplevelProperties")
|
||||
public void testToplevelProperties() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/toplevelProperties/");
|
||||
}
|
||||
|
||||
@TestMetadata("transitiveInlineFunction")
|
||||
public void testTransitiveInlineFunction() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/transitiveInlineFunction/");
|
||||
}
|
||||
|
||||
@TestMetadata("typeScriptExports")
|
||||
public void testTypeScriptExports() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/typeScriptExports/");
|
||||
}
|
||||
|
||||
@TestMetadata("unicodeSerializationAndDeserialization")
|
||||
public void testUnicodeSerializationAndDeserialization() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/unicodeSerializationAndDeserialization/");
|
||||
}
|
||||
|
||||
@TestMetadata("updateExports")
|
||||
public void testUpdateExports() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/updateExports/");
|
||||
}
|
||||
|
||||
@TestMetadata("updateExportsAndInlineImports")
|
||||
public void testUpdateExportsAndInlineImports() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/updateExportsAndInlineImports/");
|
||||
}
|
||||
|
||||
@TestMetadata("variance")
|
||||
public void testVariance() throws Exception {
|
||||
runTest("js/js.translator/testData/incremental/invalidation/variance/");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@ import java.util.regex.Pattern;
|
||||
@TestMetadata("js/js.translator/testData/incremental/invalidation")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class InvalidationTestGenerated extends AbstractInvalidationTest {
|
||||
public class JsIrInvalidationTestGenerated extends AbstractJsIrInvalidationTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
+1
-101
@@ -22,7 +22,7 @@ import java.util.regex.Pattern;
|
||||
public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInBox() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true, "closure/inlineAnonymousFunctions");
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true, "closure/inlineAnonymousFunctions", "es6classes");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -1783,106 +1783,6 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/es6classes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Es6classes {
|
||||
@Test
|
||||
public void testAllFilesPresentInEs6classes() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/es6classes"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("builtItTypes.kt")
|
||||
public void testBuiltItTypes() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/builtItTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimary.kt")
|
||||
public void testDefaultPrimary() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimaryExtendsAny.kt")
|
||||
public void testDefaultPrimaryExtendsAny() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimaryExtendsAny.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimaryExtendsExternal.kt")
|
||||
public void testDefaultPrimaryExtendsExternal() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimaryExtendsExternal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimaryWithSuper.kt")
|
||||
public void testDefaultPrimaryWithSuper() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimaryWithSuper.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/delegation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fieldAccess.kt")
|
||||
public void testFieldAccess() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/fieldAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritedFromExternalBySecondaryCtor.kt")
|
||||
public void testInheritedFromExternalBySecondaryCtor() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/inheritedFromExternalBySecondaryCtor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritedFromExternalClass.kt")
|
||||
public void testInheritedFromExternalClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/inheritedFromExternalClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initBlocks.kt")
|
||||
public void testInitBlocks() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/initBlocks.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerClasses.kt")
|
||||
public void testInnerClasses() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/innerClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("isInitializedFieldBeforeObjectCreation.kt")
|
||||
public void testIsInitializedFieldBeforeObjectCreation() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/isInitializedFieldBeforeObjectCreation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primaryToSecondary.kt")
|
||||
public void testPrimaryToSecondary() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/primaryToSecondary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeCorrectness.kt")
|
||||
public void testTypeCorrectness() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/typeCorrectness.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unboxChain.kt")
|
||||
public void testUnboxChain() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/unboxChain.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/esModules")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+1
-101
@@ -22,7 +22,7 @@ import java.util.regex.Pattern;
|
||||
public class FirJsBoxTestGenerated extends AbstractFirJsBoxTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInBox() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true, "es6classes");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -1841,106 +1841,6 @@ public class FirJsBoxTestGenerated extends AbstractFirJsBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/es6classes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Es6classes {
|
||||
@Test
|
||||
public void testAllFilesPresentInEs6classes() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/es6classes"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("builtItTypes.kt")
|
||||
public void testBuiltItTypes() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/builtItTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimary.kt")
|
||||
public void testDefaultPrimary() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimaryExtendsAny.kt")
|
||||
public void testDefaultPrimaryExtendsAny() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimaryExtendsAny.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimaryExtendsExternal.kt")
|
||||
public void testDefaultPrimaryExtendsExternal() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimaryExtendsExternal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimaryWithSuper.kt")
|
||||
public void testDefaultPrimaryWithSuper() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimaryWithSuper.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/delegation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fieldAccess.kt")
|
||||
public void testFieldAccess() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/fieldAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritedFromExternalBySecondaryCtor.kt")
|
||||
public void testInheritedFromExternalBySecondaryCtor() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/inheritedFromExternalBySecondaryCtor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritedFromExternalClass.kt")
|
||||
public void testInheritedFromExternalClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/inheritedFromExternalClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initBlocks.kt")
|
||||
public void testInitBlocks() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/initBlocks.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerClasses.kt")
|
||||
public void testInnerClasses() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/innerClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("isInitializedFieldBeforeObjectCreation.kt")
|
||||
public void testIsInitializedFieldBeforeObjectCreation() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/isInitializedFieldBeforeObjectCreation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primaryToSecondary.kt")
|
||||
public void testPrimaryToSecondary() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/primaryToSecondary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeCorrectness.kt")
|
||||
public void testTypeCorrectness() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/typeCorrectness.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unboxChain.kt")
|
||||
public void testUnboxChain() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/unboxChain.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/esModules")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+10909
File diff suppressed because it is too large
Load Diff
+1
-101
@@ -22,7 +22,7 @@ import java.util.regex.Pattern;
|
||||
public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInBox() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true, "es6classes");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -1841,106 +1841,6 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/es6classes")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Es6classes {
|
||||
@Test
|
||||
public void testAllFilesPresentInEs6classes() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/es6classes"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("builtItTypes.kt")
|
||||
public void testBuiltItTypes() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/builtItTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimary.kt")
|
||||
public void testDefaultPrimary() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimaryExtendsAny.kt")
|
||||
public void testDefaultPrimaryExtendsAny() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimaryExtendsAny.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimaryExtendsExternal.kt")
|
||||
public void testDefaultPrimaryExtendsExternal() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimaryExtendsExternal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("defaultPrimaryWithSuper.kt")
|
||||
public void testDefaultPrimaryWithSuper() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/defaultPrimaryWithSuper.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/delegation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fieldAccess.kt")
|
||||
public void testFieldAccess() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/fieldAccess.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritedFromExternalBySecondaryCtor.kt")
|
||||
public void testInheritedFromExternalBySecondaryCtor() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/inheritedFromExternalBySecondaryCtor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inheritedFromExternalClass.kt")
|
||||
public void testInheritedFromExternalClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/inheritedFromExternalClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("initBlocks.kt")
|
||||
public void testInitBlocks() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/initBlocks.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerClasses.kt")
|
||||
public void testInnerClasses() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/innerClasses.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("isInitializedFieldBeforeObjectCreation.kt")
|
||||
public void testIsInitializedFieldBeforeObjectCreation() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/isInitializedFieldBeforeObjectCreation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("primaryToSecondary.kt")
|
||||
public void testPrimaryToSecondary() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/primaryToSecondary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeCorrectness.kt")
|
||||
public void testTypeCorrectness() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/typeCorrectness.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unboxChain.kt")
|
||||
public void testUnboxChain() throws Exception {
|
||||
runTest("js/js.translator/testData/box/es6classes/unboxChain.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("js/js.translator/testData/box/esModules")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
Generated
+131
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.ir;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateJsTestsKt}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/boxError")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class IrJsES6CodegenBoxErrorTestGenerated extends AbstractIrJsES6CodegenBoxErrorTest {
|
||||
@Test
|
||||
public void testAllFilesPresentInBoxError() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxError"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true, "compileKotlinAgainstKotlin");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxError/semantic")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Semantic {
|
||||
@Test
|
||||
public void testAllFilesPresentInSemantic() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxError/semantic"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("castToErrorType.kt")
|
||||
public void testCastToErrorType() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/semantic/castToErrorType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("catchErrorType.kt")
|
||||
public void testCatchErrorType() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/semantic/catchErrorType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("evaluationOrder.kt")
|
||||
public void testEvaluationOrder() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/semantic/evaluationOrder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mismatchTypeParameters.kt")
|
||||
public void testMismatchTypeParameters() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/semantic/mismatchTypeParameters.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("missedBody.kt")
|
||||
public void testMissedBody() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/semantic/missedBody.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("reifiedNonInline.kt")
|
||||
public void testReifiedNonInline() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/semantic/reifiedNonInline.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("reifiedWithWrongArguments.kt")
|
||||
public void testReifiedWithWrongArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/semantic/reifiedWithWrongArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typeMismatch.kt")
|
||||
public void testTypeMismatch() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/semantic/typeMismatch.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unmatchedArguments.kt")
|
||||
public void testUnmatchedArguments() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/semantic/unmatchedArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unresolvedFunctionReferece.kt")
|
||||
public void testUnresolvedFunctionReferece() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/semantic/unresolvedFunctionReferece.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/boxError/syntax")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class Syntax {
|
||||
@Test
|
||||
public void testAllFilesPresentInSyntax() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxError/syntax"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrowReference.kt")
|
||||
public void testArrowReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/syntax/arrowReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("evaluationOrder.kt")
|
||||
public void testEvaluationOrder() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/syntax/evaluationOrder.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorectLexicalName.kt")
|
||||
public void testIncorectLexicalName() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/syntax/incorectLexicalName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("missedArgument.kt")
|
||||
public void testMissedArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxError/syntax/missedArgument.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
+37174
File diff suppressed because it is too large
Load Diff
Generated
+5087
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1331
|
||||
|
||||
fun box(): String {
|
||||
val s = String()
|
||||
val ints = Array<Int>(2) { i -> (i + 2) * 2 }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1344
|
||||
|
||||
open class A(var value: Int) {
|
||||
init {
|
||||
value *= 2
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1347
|
||||
|
||||
var sideEffect = ""
|
||||
|
||||
abstract class A {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
//IGNORE_BACKEND: JS, JS_IR
|
||||
|
||||
var sideEffect = ""
|
||||
|
||||
open external class E()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1355
|
||||
|
||||
var sideEffect = ""
|
||||
|
||||
open class Summator(x: Int, y: Int) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1359
|
||||
|
||||
open class A(val x: Int) {
|
||||
constructor(): this(100)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1340
|
||||
|
||||
open class A(val x: Int)
|
||||
|
||||
class B(val p: Int, val q: Int): A(p + q)
|
||||
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
//IGNORE_BACKEND: JS, JS_IR
|
||||
|
||||
open external class E(x: Int, y: Int) {
|
||||
val t: Int = definedExternally
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
//IGNORE_BACKEND: JS, JS_IR
|
||||
|
||||
open external class E(x: Int, y: Int) {
|
||||
val t: Int = definedExternally
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1345
|
||||
|
||||
var sideEffect = ""
|
||||
|
||||
open class A(var value: Int) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1343
|
||||
|
||||
abstract class A {
|
||||
abstract fun foo(): String
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1341
|
||||
|
||||
open class A(val x: Int, val y: Int) {
|
||||
constructor(x: Int) : this(x, x)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class JsFoo {
|
||||
static instances = new Set();
|
||||
constructor(value) {
|
||||
this.value = value;
|
||||
JsFoo.instances.add(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
@JsName("Set")
|
||||
external class JsSet<T> {
|
||||
fun has(value: T): Boolean
|
||||
}
|
||||
|
||||
external open class JsFoo(value: String) {
|
||||
val value: String
|
||||
companion object {
|
||||
val instances: JsSet<JsFoo>
|
||||
}
|
||||
}
|
||||
|
||||
class KotlinFoo(value: String) : JsFoo(value) {
|
||||
fun existsInJs(): Boolean = JsFoo.instances.has(this)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = KotlinFoo("TEST")
|
||||
|
||||
assertEquals("TEST", foo.value)
|
||||
assertEquals(true, foo.existsInJs())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1358
|
||||
|
||||
open class A(var value: Int)
|
||||
|
||||
open class B : A {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1371
|
||||
|
||||
inline class I1(val a: Int)
|
||||
inline class I2(val i: I1)
|
||||
inline class I3(val i: I2)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1251
|
||||
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// KT-41227
|
||||
|
||||
var result = ""
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1288
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// FILE: foo.kt
|
||||
|
||||
package foo
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// IGNORE_FIR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR, JS_IR_ES6
|
||||
// EXPECTED_REACHABLE_NODES: 1336
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1288
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// CHECK_CONTAINS_NO_CALLS: box except=equals;Baz_getInstance;callLocal;callLocalExtension TARGET_BACKENDS=JS
|
||||
// CHECK_CONTAINS_NO_CALLS: box except=Foo_getInstance;Bar;Baz_getInstance;callLocal;callLocalExtension IGNORED_BACKENDS=JS
|
||||
// CHECK_CONTAINS_NO_CALLS: callLocal
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1285
|
||||
package foo
|
||||
|
||||
// CHECK_CONTAINS_NO_CALLS: myMultiply except=A;imul
|
||||
// CHECK_CONTAINS_NO_CALLS: myMultiply except=A;imul;new_foo_A_16tm4z_k$
|
||||
|
||||
internal class A(val a: Int)
|
||||
|
||||
internal inline fun <T, R> with2(receiver: T, arg1: R, arg2: R, f: T.(R, R) -> R): R = receiver.f(arg1, arg2)
|
||||
|
||||
// CHECK_BREAKS_COUNT: function=myMultiply count=0 TARGET_BACKENDS=JS_IR
|
||||
// CHECK_LABELS_COUNT: function=myMultiply name=$l$block count=0 TARGET_BACKENDS=JS_IR
|
||||
// CHECK_BREAKS_COUNT: function=myMultiply count=0 TARGET_BACKENDS=JS_IR,JS_IR_ES6
|
||||
// CHECK_LABELS_COUNT: function=myMultiply name=$l$block count=0 TARGET_BACKENDS=JS_IR,JS_IR_ES6
|
||||
internal fun myMultiply(a: Int, b: Int, c: Int): Int = with2(A(a), b, c) { x, y -> a*x*y }
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -209,7 +209,7 @@ fun testNullableUnderlyingType() {
|
||||
caseJsEq()
|
||||
}
|
||||
|
||||
// CHECK_NEW_COUNT: function=testUnderlyingWithEqualsOverride count=4
|
||||
// CHECK_NEW_COUNT: function=testUnderlyingWithEqualsOverride count=4 TARGET_BACKENDS=JS_IR
|
||||
// CHECK_CALLED_IN_SCOPE: scope=testUnderlyingWithEqualsOverride function=equals
|
||||
fun testUnderlyingWithEqualsOverride() {
|
||||
val x0 = ClassUnderlayingWithEquals(MyClass(0))
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// IGNORE_FIR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// EXPECTED_REACHABLE_NODES: 1397
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// IGNORE_FIR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1285
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
package foo
|
||||
|
||||
external class A {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// IGNORE_FIR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR, JS_IR_ES6
|
||||
|
||||
// MODULE: AT
|
||||
// FILE: at.kt
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: WASM
|
||||
// WASM_MUTE_REASON: CLASS_EXPORT
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// EXPECTED_REACHABLE_NODES: 1294
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// IGNORE_FIR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR, JS_IR_ES6
|
||||
// EXPECTED_REACHABLE_NODES: 1454
|
||||
|
||||
// MODULE: lib1
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// FILE: main.kt
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.KType
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
|
||||
|
||||
fun test(case: String, expctedMessage: String?, expectedCause: Throwable?, expectedToString: String, t: Throwable): String {
|
||||
val actualMessage = t.message
|
||||
if (actualMessage != expctedMessage) return "$case FAIL message: $actualMessage, expcted: $expctedMessage"
|
||||
|
||||
Vendored
+2
@@ -1,3 +1,5 @@
|
||||
MUTED
|
||||
|
||||
MODULES: lib1, lib2, main
|
||||
|
||||
STEP 0:
|
||||
|
||||
+2
-2
@@ -11,5 +11,5 @@ fun baz() = 1
|
||||
|
||||
fun bar() = 2
|
||||
|
||||
// LINES(JS): 1 3 3 2 2 4 3 4 4 4 5 5 2 8 8 10 10 10 12 12 12
|
||||
// LINES(JS_IR): 1 2 * 3 4 5 * 8 8 10 10 10 10 12 12 12 12
|
||||
// LINES(JS): 1 3 3 2 2 4 3 4 4 4 5 5 2 8 8 10 10 10 12 12 12
|
||||
// LINES(JS_IR): 1 2 8 * 3 4 5 * 8 8 10 10 10 10 12 12 12 12
|
||||
|
||||
+2
-2
@@ -7,5 +7,5 @@ fun box(
|
||||
println(y)
|
||||
}
|
||||
|
||||
// LINES(JS): 1 8 2 2 2 2 3 3 3 4 6 6 7 7
|
||||
// LINES(JS_IR): 1 2 3 2 4 6 6 7 7
|
||||
// LINES(JS): 1 8 2 2 2 2 3 3 3 4 6 6 7 7
|
||||
// LINES(JS_IR): 1 2 3 5 2 4 6 6 7 7
|
||||
|
||||
+2
@@ -18,5 +18,7 @@ declare namespace JS_TESTS {
|
||||
function genericWithMultipleConstraints<T extends unknown/* kotlin.Comparable<T> */ & foo.SomeExternalInterface & Error>(x: T): T;
|
||||
function generic3<A, B, C, D, E>(a: A, b: B, c: C, d: D): Nullable<E>;
|
||||
function inlineFun(x: number, callback: (p0: number) => void): void;
|
||||
function formatList(value: any/* kotlin.collections.List<UnknownType *> */): string;
|
||||
function createList(): any/* kotlin.collections.List<UnknownType *> */;
|
||||
}
|
||||
}
|
||||
|
||||
+8
-1
@@ -6,6 +6,7 @@
|
||||
// SKIP_NODE_JS
|
||||
// INFER_MAIN_MODULE
|
||||
// MODULE: JS_TESTS
|
||||
// WITH_STDLIB
|
||||
// FILE: functions.kt
|
||||
|
||||
@file:JsExport
|
||||
@@ -64,4 +65,10 @@ fun <A, B, C, D, E> generic3(a: A, b: B, c: C, d: D): E? = null
|
||||
|
||||
inline fun inlineFun(x: Int, callback: (Int) -> Unit) {
|
||||
callback(x)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun formatList(value: List<*>): String = value.joinToString(", ") { it.toString() }
|
||||
|
||||
|
||||
fun createList(): List<*> = listOf(1, 2, 3)
|
||||
|
||||
+3
@@ -23,6 +23,8 @@ var varargWithOtherParameters = JS_TESTS.foo.varargWithOtherParameters;
|
||||
var varargWithComplexType = JS_TESTS.foo.varargWithComplexType;
|
||||
var genericWithConstraint = JS_TESTS.foo.genericWithConstraint;
|
||||
var genericWithMultipleConstraints = JS_TESTS.foo.genericWithMultipleConstraints;
|
||||
var formatList = JS_TESTS.foo.formatList;
|
||||
var createList = JS_TESTS.foo.createList;
|
||||
function assert(condition) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
@@ -55,5 +57,6 @@ function box() {
|
||||
var result = 0;
|
||||
inlineFun(10, function (x) { result = x; });
|
||||
assert(result === 10);
|
||||
assert(formatList(createList()) === "1, 2, 3");
|
||||
return "OK";
|
||||
}
|
||||
|
||||
+4
-1
@@ -11,7 +11,8 @@ import varargWithOtherParameters = JS_TESTS.foo.varargWithOtherParameters;
|
||||
import varargWithComplexType = JS_TESTS.foo.varargWithComplexType;
|
||||
import genericWithConstraint = JS_TESTS.foo.genericWithConstraint;
|
||||
import genericWithMultipleConstraints = JS_TESTS.foo.genericWithMultipleConstraints;
|
||||
|
||||
import formatList = JS_TESTS.foo.formatList;
|
||||
import createList = JS_TESTS.foo.createList;
|
||||
function assert(condition: boolean) {
|
||||
if (!condition) {
|
||||
throw "Assertion failed";
|
||||
@@ -54,5 +55,7 @@ function box(): string {
|
||||
inlineFun(10, x => { result = x; });
|
||||
assert(result === 10);
|
||||
|
||||
assert(formatList(createList()) === "1, 2, 3")
|
||||
|
||||
return "OK";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user