[JS FIR] Do not verify typealias JS name

Since typealiases are not present in the generated JS code,
there is no need to verify their JS names.

^KT-64463 Fixed
This commit is contained in:
Alexander Korepanov
2024-01-16 15:01:34 +01:00
committed by Space Team
parent a97518a903
commit 871f04e08c
2 changed files with 5 additions and 6 deletions
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.analysis.js.checkers
import org.jetbrains.kotlin.descriptors.Visibilities
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClassSymbol
import org.jetbrains.kotlin.fir.declarations.FirTypeAlias
import org.jetbrains.kotlin.fir.declarations.utils.*
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.*
@@ -47,6 +48,10 @@ internal data class FirJsStableName(
when (symbol) {
is FirConstructorSymbol -> return null
is FirPropertyAccessorSymbol -> return null
// Skip type aliases since they cannot be external, cannot be exported to JavaScript, and cannot be marked with @JsName.
// Furthermore, in the generated JavaScript code, all type alias declarations are removed,
// and their usages are replaced with the aliased types.
is FirTypeAliasSymbol -> return null
}
val hasStableNameInJavaScript = when {
@@ -34,12 +34,6 @@ object FirJsNameClashFileTopLevelDeclarationsChecker : FirFileChecker() {
override fun check(declaration: FirFile, context: CheckerContext, reporter: DiagnosticReporter) {
val topLevelDeclarationsWithStableName = mutableMapOf<String, MutableList<FirJsStableName>>()
for (topLevelDeclaration in declaration.declarations) {
if (topLevelDeclaration is FirTypeAlias) {
// Skip type aliases since they cannot be external, cannot be exported to JavaScript, and cannot be marked with @JsName.
// Furthermore, in the generated JavaScript code, all type alias declarations are removed,
// and their usages are replaced with the aliased types.
continue
}
topLevelDeclarationsWithStableName.addStableName(topLevelDeclaration.symbol, context)
if (topLevelDeclaration is FirClass) {
for (classConstructor in topLevelDeclaration.constructors(context.session)) {