JS backend: report diagnostic for class literal(Foo::class) instead of crash with Exception.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
$TESTDATA_DIR$/diagnosticForClassLiteral.kt
|
||||
-no-stdlib
|
||||
-output
|
||||
$TEMP_DIR$/out.js
|
||||
@@ -0,0 +1,7 @@
|
||||
package foo
|
||||
|
||||
class A
|
||||
|
||||
fun test() {
|
||||
A::class
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
WARNING: compiler/testData/cli/js/diagnosticForClassLiteral.kt: (6, 5) The expression is unused
|
||||
ERROR: compiler/testData/cli/js/diagnosticForClassLiteral.kt: (6, 6) Reflection types can't be loaded. Please ensure that you have Kotlin Runtime in your classpath
|
||||
COMPILATION_ERROR
|
||||
@@ -183,6 +183,12 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cli/js"), Pattern.compile("^(.+)\\.args$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("diagnosticForClassLiteral.args")
|
||||
public void testDiagnosticForClassLiteral() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/diagnosticForClassLiteral.args");
|
||||
doJsTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("diagnosticForUnhandledElements.args")
|
||||
public void testDiagnosticForUnhandledElements() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/diagnosticForUnhandledElements.args");
|
||||
|
||||
-5
@@ -183,11 +183,6 @@ public final class ExpressionVisitor extends TranslatorVisitor<JsNode> {
|
||||
return newVar(name, initializer).source(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsNode visitClassLiteralExpression(@NotNull JetClassLiteralExpression expression, @NotNull TranslationContext context) {
|
||||
throw new UnsupportedOperationException("Class literals are not yet supported: " + expression.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public JsNode visitCallableReferenceExpression(@NotNull JetCallableReferenceExpression expression, @NotNull TranslationContext context) {
|
||||
|
||||
Reference in New Issue
Block a user