[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)
|
dataFlowAnalyzer.enterProperty(property)
|
||||||
withFullBodyResolve {
|
withFullBodyResolve {
|
||||||
withScopeCleanup(localScopes) {
|
withScopeCleanup(localScopes) {
|
||||||
localScopes.addIfNotNull(primaryConstructorParametersScope)
|
|
||||||
components.withContainer(property) {
|
components.withContainer(property) {
|
||||||
property.transformChildrenWithoutAccessors(returnTypeRef)
|
withScopeCleanup(localScopes) {
|
||||||
property.transformInitializer(integerLiteralTypeApproximator, null)
|
localScopes.addIfNotNull(primaryConstructorParametersScope)
|
||||||
|
property.transformChildrenWithoutAccessors(returnTypeRef)
|
||||||
|
property.transformInitializer(integerLiteralTypeApproximator, null)
|
||||||
|
}
|
||||||
if (property.initializer != null) {
|
if (property.initializer != null) {
|
||||||
storeVariableReturnType(property)
|
storeVariableReturnType(property)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ class Foo(val a: Int, b: Int) {
|
|||||||
get() = a
|
get() = a
|
||||||
|
|
||||||
val e: Int
|
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) {
|
class C(p: Any, val v: Any) {
|
||||||
|
|
||||||
val test1 get() = p
|
val test1 get() = <!UNRESOLVED_REFERENCE!>p<!>
|
||||||
|
|
||||||
val test2 get() = v
|
val test2 get() = v
|
||||||
|
|
||||||
// NB here we can use both 'T' (property type parameter) and 'p' (primary constructor parameter)
|
// 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 <T> List<T>.test3 by delegateFactory<T>(p)
|
||||||
|
|
||||||
val test4 get() { return p }
|
val test4 get() { return <!UNRESOLVED_REFERENCE!>p<!> }
|
||||||
|
|
||||||
var test5
|
var test5
|
||||||
get() { return p }
|
get() { return <!UNRESOLVED_REFERENCE!>p<!> }
|
||||||
set(nv) { p.let {} }
|
set(nv) { <!UNRESOLVED_REFERENCE!>p<!>.<!INAPPLICABLE_CANDIDATE!>let<!> {} }
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user