From 4a5b900d28255d23490f627f27db0f66eb5178b9 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Fri, 19 Apr 2019 19:37:01 +0300 Subject: [PATCH] FIR: get rid of library type parameter symbol --- .../kotlin/fir/backend/ConversionUtils.kt | 8 ------- .../fir/backend/Fir2IrDeclarationStorage.kt | 22 ------------------- .../fir/symbols/LibraryTypeParameterSymbol.kt | 12 ---------- 3 files changed, 42 deletions(-) delete mode 100644 compiler/fir/resolve/src/org/jetbrains/kotlin/fir/symbols/LibraryTypeParameterSymbol.kt diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt index 5c16a793a21..378a89baf7e 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.fir.backend import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.resolve.toSymbol import org.jetbrains.kotlin.fir.symbols.ConeClassifierSymbol -import org.jetbrains.kotlin.fir.symbols.LibraryTypeParameterSymbol import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.ir.IrElement @@ -82,9 +81,6 @@ fun ConeClassifierSymbol.toIrSymbol(session: FirSession, declarationStorage: Fir is FirTypeParameterSymbol -> { toTypeParameterSymbol(declarationStorage) } - is LibraryTypeParameterSymbol -> { - toTypeParameterSymbol(declarationStorage) - } is FirTypeAliasSymbol -> { val typeAlias = fir val coneClassLikeType = (typeAlias.expandedTypeRef as FirResolvedTypeRef).type as ConeClassLikeType @@ -123,10 +119,6 @@ fun FirTypeParameterSymbol.toTypeParameterSymbol(declarationStorage: Fir2IrDecla return declarationStorage.getIrTypeParameterSymbol(this) } -fun LibraryTypeParameterSymbol.toTypeParameterSymbol(declarationStorage: Fir2IrDeclarationStorage): IrTypeParameterSymbol { - return declarationStorage.getIrTypeParameterSymbol(this) -} - fun FirFunctionSymbol.toFunctionSymbol(declarationStorage: Fir2IrDeclarationStorage): IrFunctionSymbol { return declarationStorage.getIrFunctionSymbol(this) } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index 759c3ee68d4..5ee1f104aad 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -17,7 +17,6 @@ import org.jetbrains.kotlin.fir.expressions.FirVariable import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.resolve.FirSymbolProvider import org.jetbrains.kotlin.fir.service -import org.jetbrains.kotlin.fir.symbols.LibraryTypeParameterSymbol import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.* @@ -29,7 +28,6 @@ import org.jetbrains.kotlin.ir.util.SymbolTable import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtFunctionLiteral -import org.jetbrains.kotlin.types.Variance class Fir2IrDeclarationStorage( private val session: FirSession, @@ -44,8 +42,6 @@ class Fir2IrDeclarationStorage( private val typeParameterCache = mutableMapOf() - private val libraryTypeParameterCache = mutableMapOf() - private val functionCache = mutableMapOf() private val constructorCache = mutableMapOf() @@ -414,24 +410,6 @@ class Fir2IrDeclarationStorage( return irSymbolTable.referenceTypeParameter(irTypeParameter.descriptor) } - fun getIrTypeParameterSymbol(typeParameterSymbol: LibraryTypeParameterSymbol): IrTypeParameterSymbol { - val irTypeParameter = libraryTypeParameterCache.getOrPut(typeParameterSymbol) { - val descriptor = WrappedTypeParameterDescriptor() - val origin = IrDeclarationOrigin.DEFINED - irSymbolTable.declareGlobalTypeParameter(-1, -1, origin, descriptor) { symbol -> - IrTypeParameterImpl( - -1, -1, origin, symbol, - typeParameterSymbol.name, -1, - false, - Variance.INVARIANT - ).apply { - descriptor.bind(this) - } - } - } - return irSymbolTable.referenceTypeParameter(irTypeParameter.descriptor) - } - fun getIrFunctionSymbol(firFunctionSymbol: FirFunctionSymbol): IrFunctionSymbol { return when (val firDeclaration = firFunctionSymbol.fir) { is FirNamedFunction -> { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/symbols/LibraryTypeParameterSymbol.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/symbols/LibraryTypeParameterSymbol.kt deleted file mode 100644 index 1a5c4a2ae97..00000000000 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/symbols/LibraryTypeParameterSymbol.kt +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. 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.fir.symbols - -import org.jetbrains.kotlin.name.Name - -class LibraryTypeParameterSymbol(override val name: Name) : ConeTypeParameterSymbol { - -} \ No newline at end of file