[AA] Remove classifiers from non-static declared member scopes
- The semantics of a non-static declared member scope should be as follows: For a variable `c: C` of class type `C`, the declared member scope should contain all members `x` accessible as `c.x` (visibility notwithstanding) which are *also* explicitly declared in `C`. - Classifiers are not accessible as properties of a variable `c`, only as static members of the class `C` itself, so non-static declared member scopes should not contain any classifiers. ^KT-61800
This commit is contained in:
committed by
Space Team
parent
8b24baade9
commit
5679acbbdb
-34
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* 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.fir.scopes.impl
|
||||
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.isStatic
|
||||
import org.jetbrains.kotlin.fir.scopes.FirContainingNamesAwareScope
|
||||
import org.jetbrains.kotlin.fir.scopes.FirDelegatingContainingNamesAwareScope
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
/**
|
||||
* A counterpart to [FirStaticScope] that contains only the *non-static* callables and all classifiers of the [delegate] scope.
|
||||
*/
|
||||
class FirNonStaticCallablesScope(private val delegate: FirContainingNamesAwareScope) : FirDelegatingContainingNamesAwareScope(delegate) {
|
||||
override fun processFunctionsByName(name: Name, processor: (FirNamedFunctionSymbol) -> Unit) {
|
||||
delegate.processFunctionsByName(name) {
|
||||
if (!it.fir.isStatic) {
|
||||
processor(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun processPropertiesByName(name: Name, processor: (FirVariableSymbol<*>) -> Unit) {
|
||||
delegate.processPropertiesByName(name) {
|
||||
if (!it.fir.isStatic) {
|
||||
processor(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user