Generate super classes and overridden functions in proper scope

Such references require proper scope so that local symbols are bound.
Example:

```
fun <T> outer() {
    abstract class ALocal<S : T> {
        abstract fun bar()
    }

    class Local<S : T> : ALocal<S>() {
        override fun bar() {}
    }
}
```

Here local classes have type parameters with upper bounds depending on
function type parameters, and members overriding members in other local
classes.
This commit is contained in:
Dmitry Petrov
2018-02-22 10:00:02 +03:00
parent 8fef0f0535
commit e89047d2cc
54 changed files with 2463 additions and 79 deletions
@@ -1,6 +1,8 @@
FILE fqName:<root> fileName:/typeParameterWithPrimitiveNumericSupertype.kt
FUN name:test0 visibility:public modality:FINAL <T> (x:kotlin.Any, y:T) returnType:Boolean flags:
TYPE_PARAMETER name:T index:0 variance: upperBounds:[kotlin.Any?]
superClassifiers:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Any modality:OPEN visibility:public flags:
VALUE_PARAMETER name:x index:0 type:kotlin.Any flags:
VALUE_PARAMETER name:y index:1 type:T flags:
BLOCK_BODY
@@ -17,6 +19,8 @@ FILE fqName:<root> fileName:/typeParameterWithPrimitiveNumericSupertype.kt
then: CONST Boolean type=kotlin.Boolean value=false
FUN name:test1 visibility:public modality:FINAL <T> (x:kotlin.Any, y:T) returnType:Boolean flags:
TYPE_PARAMETER name:T index:0 variance: upperBounds:[kotlin.Float]
superClassifiers:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags:
VALUE_PARAMETER name:x index:0 type:kotlin.Any flags:
VALUE_PARAMETER name:y index:1 type:T flags:
BLOCK_BODY
@@ -34,6 +38,8 @@ FILE fqName:<root> fileName:/typeParameterWithPrimitiveNumericSupertype.kt
then: CONST Boolean type=kotlin.Boolean value=false
FUN name:test2 visibility:public modality:FINAL <T> (x:kotlin.Any, y:T) returnType:Boolean flags:
TYPE_PARAMETER name:T index:0 variance: upperBounds:[kotlin.Double]
superClassifiers:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Double modality:FINAL visibility:public flags:
VALUE_PARAMETER name:x index:0 type:kotlin.Any flags:
VALUE_PARAMETER name:y index:1 type:T flags:
BLOCK_BODY
@@ -52,6 +58,8 @@ FILE fqName:<root> fileName:/typeParameterWithPrimitiveNumericSupertype.kt
then: CONST Boolean type=kotlin.Boolean value=false
FUN name:test3 visibility:public modality:FINAL <T> (x:kotlin.Any, y:T) returnType:Boolean flags:
TYPE_PARAMETER name:T index:0 variance: upperBounds:[kotlin.Float]
superClassifiers:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags:
VALUE_PARAMETER name:x index:0 type:kotlin.Any flags:
VALUE_PARAMETER name:y index:1 type:T flags:
BLOCK_BODY
@@ -70,6 +78,8 @@ FILE fqName:<root> fileName:/typeParameterWithPrimitiveNumericSupertype.kt
then: CONST Boolean type=kotlin.Boolean value=false
FUN name:test4 visibility:public modality:FINAL <T> (x:kotlin.Any, y:T) returnType:Boolean flags:
TYPE_PARAMETER name:T index:0 variance: upperBounds:[kotlin.Float?]
superClassifiers:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags:
VALUE_PARAMETER name:x index:0 type:kotlin.Any flags:
VALUE_PARAMETER name:y index:1 type:T flags:
BLOCK_BODY
@@ -88,7 +98,11 @@ FILE fqName:<root> fileName:/typeParameterWithPrimitiveNumericSupertype.kt
then: CONST Boolean type=kotlin.Boolean value=false
FUN name:test5 visibility:public modality:FINAL <T, R> (x:kotlin.Any, y:R) returnType:Boolean flags:
TYPE_PARAMETER name:T index:0 variance: upperBounds:[kotlin.Float?]
superClassifiers:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags:
TYPE_PARAMETER name:R index:1 variance: upperBounds:[T]
superClassifiers:
TYPE_PARAMETER name:T index:0 variance: upperBounds:[kotlin.Float?]
VALUE_PARAMETER name:x index:0 type:kotlin.Any flags:
VALUE_PARAMETER name:y index:1 type:R flags:
BLOCK_BODY
@@ -107,6 +121,8 @@ FILE fqName:<root> fileName:/typeParameterWithPrimitiveNumericSupertype.kt
then: CONST Boolean type=kotlin.Boolean value=false
FUN name:test6 visibility:public modality:FINAL <T> (x:kotlin.Any, y:T) returnType:Boolean flags:
TYPE_PARAMETER name:T index:0 variance: upperBounds:[kotlin.Number]
superClassifiers:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Number modality:ABSTRACT visibility:public flags:
VALUE_PARAMETER name:x index:0 type:kotlin.Any flags:
VALUE_PARAMETER name:y index:1 type:T flags:
BLOCK_BODY
@@ -126,6 +142,8 @@ FILE fqName:<root> fileName:/typeParameterWithPrimitiveNumericSupertype.kt
superClasses:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Any modality:OPEN visibility:public flags:
TYPE_PARAMETER name:T index:0 variance: upperBounds:[kotlin.Float]
superClassifiers:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Float modality:FINAL visibility:public flags:
CONSTRUCTOR visibility:public <> () returnType:F<T> flags:
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'