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:/argumentMappedWithError.kt
FUN name:convert visibility:public modality:FINAL <R> ($receiver:kotlin.Number) returnType:R flags:
TYPE_PARAMETER name:R index:0 variance: upperBounds:[kotlin.Number]
superClassifiers:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Number modality:ABSTRACT visibility:public flags:
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Number flags:
BLOCK_BODY
RETURN type=kotlin.Nothing from='convert() on Number: R'
@@ -4,6 +4,8 @@ FILE fqName:<root> fileName:/callableRefToGenericMember.kt
superClasses:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Any modality:OPEN visibility:public 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:
CONSTRUCTOR visibility:public <> () returnType:A<T> flags:
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
@@ -8,6 +8,12 @@ MODULE_FRAGMENT name:<built-ins module>
FUN IR_EXTERNAL_DECLARATION_STUB name:invoke visibility:public modality:ABSTRACT <> (p1:P1) returnType:R flags:
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:p1 index:0 type:P1 flags:
FUN IR_EXTERNAL_DECLARATION_STUB name:equals visibility:public modality:OPEN <> (other:kotlin.Any?) returnType:Boolean flags:
overridden:
UNBOUND: fun equals(other: kotlin.Any?): kotlin.Boolean
VALUE_PARAMETER IR_EXTERNAL_DECLARATION_STUB name:other index:0 type:kotlin.Any? flags:
FUN IR_EXTERNAL_DECLARATION_STUB name:hashCode visibility:public modality:OPEN <> () returnType:Int flags:
overridden:
UNBOUND: fun hashCode(): kotlin.Int
FUN IR_EXTERNAL_DECLARATION_STUB name:toString visibility:public modality:OPEN <> () returnType:String flags:
overridden:
UNBOUND: fun toString(): kotlin.String
@@ -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()'
+4
View File
@@ -18,6 +18,8 @@ FILE fqName:<root> fileName:/in.kt
element: GET_VAR 'value-parameter a: Any' type=kotlin.Any origin=null
FUN name:test3 visibility:public modality:FINAL <T> (a:T, x:kotlin.collections.Collection<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:a index:0 type:T flags:
VALUE_PARAMETER name:x index:1 type:kotlin.collections.Collection<T> flags:
BLOCK_BODY
@@ -27,6 +29,8 @@ FILE fqName:<root> fileName:/in.kt
element: GET_VAR 'value-parameter a: T' type=T origin=null
FUN name:test4 visibility:public modality:FINAL <T> (a:T, x:kotlin.collections.Collection<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:a index:0 type:T flags:
VALUE_PARAMETER name:x index:1 type:kotlin.collections.Collection<T> flags:
BLOCK_BODY
@@ -4,6 +4,8 @@ FILE fqName:<root> fileName:/thisOfGenericOuterClass.kt
superClasses:
CLASS IR_EXTERNAL_DECLARATION_STUB CLASS name:Any modality:OPEN visibility:public 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:
CONSTRUCTOR visibility:public <> (x:T) returnType:Outer<T> flags:
VALUE_PARAMETER name:x index:0 type:T flags:
BLOCK_BODY