[FIR] Hide primary constructor parameters from accessors
This commit is contained in:
+6
-3
@@ -100,10 +100,13 @@ class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransformer)
|
||||
dataFlowAnalyzer.enterProperty(property)
|
||||
withFullBodyResolve {
|
||||
withScopeCleanup(localScopes) {
|
||||
localScopes.addIfNotNull(primaryConstructorParametersScope)
|
||||
|
||||
components.withContainer(property) {
|
||||
property.transformChildrenWithoutAccessors(returnTypeRef)
|
||||
property.transformInitializer(integerLiteralTypeApproximator, null)
|
||||
withScopeCleanup(localScopes) {
|
||||
localScopes.addIfNotNull(primaryConstructorParametersScope)
|
||||
property.transformChildrenWithoutAccessors(returnTypeRef)
|
||||
property.transformInitializer(integerLiteralTypeApproximator, null)
|
||||
}
|
||||
if (property.initializer != null) {
|
||||
storeVariableReturnType(property)
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ class Foo(val a: Int, b: Int) {
|
||||
get() = a
|
||||
|
||||
val e: Int
|
||||
get() = b
|
||||
get() = <!UNRESOLVED_REFERENCE!>b<!>
|
||||
}
|
||||
+4
-4
@@ -8,16 +8,16 @@ fun <T> delegateFactory(p: Any) = Delegate
|
||||
|
||||
class C(p: Any, val v: Any) {
|
||||
|
||||
val test1 get() = p
|
||||
val test1 get() = <!UNRESOLVED_REFERENCE!>p<!>
|
||||
|
||||
val test2 get() = v
|
||||
|
||||
// NB here we can use both 'T' (property type parameter) and 'p' (primary constructor parameter)
|
||||
val <T> List<T>.test3 by delegateFactory<T>(p)
|
||||
|
||||
val test4 get() { return p }
|
||||
val test4 get() { return <!UNRESOLVED_REFERENCE!>p<!> }
|
||||
|
||||
var test5
|
||||
get() { return p }
|
||||
set(nv) { p.let {} }
|
||||
get() { return <!UNRESOLVED_REFERENCE!>p<!> }
|
||||
set(nv) { <!UNRESOLVED_REFERENCE!>p<!>.<!INAPPLICABLE_CANDIDATE!>let<!> {} }
|
||||
}
|
||||
Reference in New Issue
Block a user