K2: don't use outer class type parameters during nested class TP resolve

Before this commit, we allowed access to outer class type parameters
during resolve of type parameter bounds of a nested class.
In fact, outer type parameters are accessible in this situation
only if it's an inner class (or a local class).
This commit forbids such a usage. In the earlier fix of KT-57209
the same was done for regular type reference resolve.

#KT-61459 Fixed
#KT-61959 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-09-08 17:08:56 +02:00
committed by Space Team
parent cdc197c723
commit 9cf1d36e5e
7 changed files with 10 additions and 40 deletions
@@ -1,22 +0,0 @@
// ISSUE: KT-61459
interface Alarm {
interface Builder<Self : Builder<Self>> {
fun build(): Alarm
}
}
abstract class AbstractAlarm<Self : AbstractAlarm<Self, Builder>, Builder : AbstractAlarm.Builder<Builder, Self>>(
val identifier: String,
) : Alarm {
abstract class Builder<Self : Builder<!TYPE_ARGUMENTS_NOT_ALLOWED!><Self, Built><!>, Built : AbstractAlarm<Built, <!UPPER_BOUND_VIOLATED!>Self<!>>> : Alarm.Builder<<!UPPER_BOUND_VIOLATED!>Self<!>> {
private var identifier: String = ""
fun setIdentifier(text: String): Self {
this.identifier = text
return this <!UNCHECKED_CAST!>as Self<!>
}
final override fun build(): Built = TODO()
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// ISSUE: KT-61459
interface Alarm {