Removed useless as casts from compiler code
It allows compiling code with K2 and enabled `-Werror`
This commit is contained in:
committed by
Space Team
parent
d50c6f1b6d
commit
1827df82c4
+2
-3
@@ -300,10 +300,9 @@ class KtFe10ExpressionTypeProvider(
|
||||
}
|
||||
|
||||
override fun isDefinitelyNotNull(expression: KtExpression): Boolean {
|
||||
val ktExpression = expression as? KtExpression ?: return false
|
||||
val bindingContext = analysisContext.analyze(ktExpression)
|
||||
val bindingContext = analysisContext.analyze(expression)
|
||||
|
||||
val smartCasts = bindingContext[BindingContext.SMARTCAST, ktExpression]
|
||||
val smartCasts = bindingContext[BindingContext.SMARTCAST, expression]
|
||||
|
||||
if (smartCasts is MultipleSmartCasts) {
|
||||
if (smartCasts.map.values.all { !it.isMarkedNullable }) {
|
||||
|
||||
+1
-2
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolWithMembers
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.requireIsInstance
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||
import org.jetbrains.kotlin.fir.declarations.FirResolvePhase
|
||||
import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||
import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope
|
||||
@@ -42,7 +41,7 @@ internal abstract class KtFirMemberSymbolPointer<S : KtSymbol>(
|
||||
val firSession = useSiteSession
|
||||
val scopeSession = getScopeSessionFor(firSession)
|
||||
return if (isStatic) {
|
||||
val firClass = owner.fir as? FirClass ?: return null
|
||||
val firClass = owner.fir
|
||||
firClass.scopeProvider.getStaticMemberScopeForCallables(firClass, firSession, scopeSession)
|
||||
} else {
|
||||
owner.unsubstitutedScope(
|
||||
|
||||
+1
-2
@@ -36,8 +36,7 @@ abstract class AbstractRendererTest : AbstractAnalysisApiSingleFileTest() {
|
||||
buildString {
|
||||
ktFile.declarations.forEach { declaration ->
|
||||
analyseForTest(declaration) {
|
||||
val symbol = declaration.getSymbol() as? KtDeclarationSymbol ?: return@analyseForTest
|
||||
append(symbol.render(renderer))
|
||||
append(declaration.getSymbol().render(renderer))
|
||||
appendLine()
|
||||
appendLine()
|
||||
}
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ internal class StubBasedFirTypeDeserializer(
|
||||
val annotations = annotationDeserializer.loadAnnotations(typeReference).toMutableList()
|
||||
val parent = (typeReference.stub ?: loadStubByElement(typeReference))?.parentStub
|
||||
if (parent is KotlinParameterStubImpl) {
|
||||
(parent as? KotlinParameterStubImpl)?.functionTypeParameterName?.let { paramName ->
|
||||
parent.functionTypeParameterName?.let { paramName ->
|
||||
annotations += buildAnnotation {
|
||||
annotationTypeRef = buildResolvedTypeRef {
|
||||
type = StandardNames.FqNames.parameterNameClassId.toLookupTag()
|
||||
|
||||
Reference in New Issue
Block a user