FIR: make FunctionType class-like, refactor built-ins resolution
This breaks total kotlin resolve test because of incorrect rendering of ConeClassErrorType (we are trying to read its symbol)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
3edd82b602
commit
9ebefa3ba6
@@ -92,7 +92,9 @@ abstract class ConeTypeParameterType : ConeSymbolBasedType() {
|
||||
}
|
||||
|
||||
|
||||
abstract class ConeFunctionType : ConeKotlinType() {
|
||||
abstract class ConeFunctionType : ConeClassLikeType() {
|
||||
|
||||
abstract override val symbol: ConeClassLikeSymbol
|
||||
abstract val receiverType: ConeKotlinType?
|
||||
abstract val parameterTypes: List<ConeKotlinType>
|
||||
abstract val returnType: ConeKotlinType
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.types.impl
|
||||
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeSymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeFunctionType
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinType
|
||||
import org.jetbrains.kotlin.fir.types.ConeKotlinTypeProjection
|
||||
@@ -12,7 +13,8 @@ import org.jetbrains.kotlin.fir.types.ConeKotlinTypeProjection
|
||||
class ConeFunctionTypeImpl(
|
||||
override val receiverType: ConeKotlinType?,
|
||||
override val parameterTypes: List<ConeKotlinType>,
|
||||
override val returnType: ConeKotlinType
|
||||
override val returnType: ConeKotlinType,
|
||||
override val symbol: ConeClassLikeSymbol
|
||||
) : ConeFunctionType() {
|
||||
override val typeArguments: Array<out ConeKotlinTypeProjection>
|
||||
get() = EMPTY_ARRAY
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
FILE: F.kt
|
||||
public? open class A {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
public? final? class B : A {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
FILE: NestedOfAliasedType.kt
|
||||
public? abstract class A {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
public? abstract class Nested {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FILE: NestedSuperType.kt
|
||||
public? abstract class My {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
public? abstract class NestedOne : My {
|
||||
public? constructor(): super<My>()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
FILE: complexTypes.kt
|
||||
<T, out S> public? final? class C {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
<R, in P> public? final? inner class D {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FILE: derivedClass.kt
|
||||
<T> public? open class Base {
|
||||
public? constructor(x: T): super<kotlin.Any>()
|
||||
public? constructor(x: T): super<kotlin/Any>()
|
||||
|
||||
public? final? property x(val): T
|
||||
public? get(): T
|
||||
|
||||
+10
-10
@@ -1,25 +1,25 @@
|
||||
FILE: enums.kt
|
||||
public? final? enum class Order {
|
||||
public? constructor(): super<kotlin.Enum>()
|
||||
public? constructor(): super<kotlin/Enum>()
|
||||
|
||||
public? final enum entry FIRST {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
public? final enum entry SECOND {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
public? final enum entry THIRD {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public? final? enum class Planet {
|
||||
public? constructor(m: Double, r: Double): super<kotlin.Enum>()
|
||||
public? constructor(m: Double, r: Double): super<kotlin/Enum>()
|
||||
|
||||
public? final? property m(val): Double
|
||||
public? get(): Double
|
||||
@@ -30,7 +30,7 @@ FILE: enums.kt
|
||||
public? final enum entry MERCURY : Planet {
|
||||
public? constructor(): super<Planet>(Double(1.0), Double(2.0))
|
||||
|
||||
public? open? override function sayHello(): kotlin.Unit {
|
||||
public? open? override function sayHello(): kotlin/Unit {
|
||||
println#(String(Hello!!!))
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ FILE: enums.kt
|
||||
public? final enum entry VENERA : Planet {
|
||||
public? constructor(): super<Planet>(Double(3.0), Double(4.0))
|
||||
|
||||
public? open? override function sayHello(): kotlin.Unit {
|
||||
public? open? override function sayHello(): kotlin/Unit {
|
||||
println#(String(Ola!!!))
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ FILE: enums.kt
|
||||
public? final enum entry EARTH : Planet {
|
||||
public? constructor(): super<Planet>(Double(5.0), Double(6.0))
|
||||
|
||||
public? open? override function sayHello(): kotlin.Unit {
|
||||
public? open? override function sayHello(): kotlin/Unit {
|
||||
println#(String(Privet!!!))
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ FILE: enums.kt
|
||||
public? final? property g(val): Double = div#(times#(G#, m#), times#(r#, r#))
|
||||
public? get(): Double
|
||||
|
||||
public? abstract function sayHello(): kotlin.Unit
|
||||
public? abstract function sayHello(): kotlin/Unit
|
||||
|
||||
public? final? companion object Companion {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
public? final? const property G(val): <implicit> = Double(6.67E-11)
|
||||
public? get(): <implicit>
|
||||
|
||||
@@ -2,15 +2,15 @@ FILE: enums2.kt
|
||||
public? final? interface Some {
|
||||
}
|
||||
public? final? object O1 : Some {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
public? final? object O2 : Some {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
public? final? enum class SomeEnum {
|
||||
public? constructor(x: Some): super<kotlin.Enum>()
|
||||
public? constructor(x: Some): super<kotlin/Enum>()
|
||||
|
||||
public? final? property x(val): Some
|
||||
public? get(): Some
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
FILE: expectActual.kt
|
||||
public? final? expect class MyClass {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
public? final? expect function foo(): String
|
||||
public? final? expect property x(val): Int
|
||||
public? get(): Int
|
||||
public? final? actual class MyClass {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
public? final? actual function foo(): <implicit> {
|
||||
|
||||
@@ -5,7 +5,7 @@ FILE: genericFunctions.kt
|
||||
return@@@safeAs as?/T(this#)
|
||||
}
|
||||
public? abstract class Summator {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
<T> public? abstract function plus(first: T, second: T): T
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
FILE: nestedClass.kt
|
||||
public? abstract class Base {
|
||||
public? constructor(s: String): super<kotlin.Any>()
|
||||
public? constructor(s: String): super<kotlin/Any>()
|
||||
|
||||
public? final? property s(val): String
|
||||
public? get(): String
|
||||
|
||||
}
|
||||
public? final? class Outer {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
public? final? class Derived : Base {
|
||||
public? constructor(s: String): super<Base>(s#)
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ FILE: noPrimaryConstructor.kt
|
||||
public? final? property x(val): String
|
||||
public? get(): String
|
||||
|
||||
public? constructor(x: String): super<kotlin.Any>() {
|
||||
public? constructor(x: String): super<kotlin/Any>() {
|
||||
this#.x# = x#
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ FILE: simpleClass.kt
|
||||
|
||||
}
|
||||
public? final? class SomeClass : SomeInterface {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
private final? property baz(val): <implicit> = Int(42)
|
||||
private get(): <implicit>
|
||||
@@ -20,15 +20,15 @@ FILE: simpleClass.kt
|
||||
public? get(): Boolean {
|
||||
return Boolean(true)
|
||||
}
|
||||
public? set(value: Boolean): kotlin.Unit {
|
||||
public? set(value: Boolean): kotlin/Unit {
|
||||
}
|
||||
|
||||
public? final? lateinit property fau(var): Double
|
||||
public? get(): Double
|
||||
public? set(value: Double): kotlin.Unit
|
||||
public? set(value: Double): kotlin/Unit
|
||||
|
||||
}
|
||||
public? final? inline class InlineClass {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FILE: simpleFun.kt
|
||||
public? final? function foo(): kotlin.Unit {
|
||||
public? final? function foo(): kotlin/Unit {
|
||||
}
|
||||
public? final? suspend function bar(): kotlin.Unit {
|
||||
public? final? suspend function bar(): kotlin/Unit {
|
||||
}
|
||||
|
||||
@@ -3,6 +3,6 @@ FILE: simpleTypeAlias.kt
|
||||
}
|
||||
public? final typealias C = B
|
||||
public? final? class D : C {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
FILE: typeAliasWithGeneric.kt
|
||||
public? open class A {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
<S, T : A> public? final? interface B {
|
||||
}
|
||||
<T> public? final typealias C = B<T, A>
|
||||
public? final? class D : C<A> {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,17 +2,17 @@ FILE: typeParameterVsNested.kt
|
||||
public? final? interface Some {
|
||||
}
|
||||
<T : Some> public? abstract class My {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
public? final? inner class T {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
public? abstract property x(val): T
|
||||
public? get(): T
|
||||
|
||||
public? abstract function foo(arg: T): kotlin.Unit
|
||||
public? abstract function foo(arg: T): kotlin/Unit
|
||||
|
||||
public? abstract property y(val): My.T
|
||||
public? get(): My.T
|
||||
|
||||
@@ -8,7 +8,7 @@ FILE: typeParameters.kt
|
||||
public? final typealias StringList = List<out String>
|
||||
public? final typealias AnyList = List<*>
|
||||
<out T : Any> public? abstract class AbstractList : List<T> {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
public? final? class SomeList : AbstractList<Int> {
|
||||
|
||||
@@ -4,6 +4,6 @@ FILE: where.kt
|
||||
public? final? interface B {
|
||||
}
|
||||
<T : A, B> public? final? class C {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FILE: annotated.kt
|
||||
@Target(AnnotationTarget#.EXPRESSION#) @Retention(AnnotationRetention#.SOURCE#) public? final? annotation class Ann {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
public? final? function foo(arg: Int): Int {
|
||||
@@ -23,10 +23,10 @@ FILE: annotated.kt
|
||||
return@@@foo Int(42)
|
||||
}
|
||||
public? final? data class Two {
|
||||
public? constructor(x: Int, y: Int): super<kotlin.Any>()
|
||||
public? constructor(x: Int, y: Int): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
public? final? function bar(two: Two): kotlin.Unit {
|
||||
public? final? function bar(two: Two): kotlin/Unit {
|
||||
val <destruct>: <implicit> = two#
|
||||
@Ann() val x: <implicit> = component1(<destruct>#)
|
||||
@Ann() val y: <implicit> = component2(<destruct>#)
|
||||
|
||||
@@ -5,7 +5,7 @@ FILE: arrayAccess.kt
|
||||
return@@@foo Int(1)
|
||||
}
|
||||
public? final? class Wrapper {
|
||||
public? constructor(v: IntArray): super<kotlin.Any>()
|
||||
public? constructor(v: IntArray): super<kotlin/Any>()
|
||||
|
||||
public? final? property v(val): IntArray
|
||||
public? get(): IntArray
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
FILE: arrayAssignment.kt
|
||||
public? final? function test(): kotlin.Unit {
|
||||
public? final? function test(): kotlin/Unit {
|
||||
val x: <implicit> = intArrayOf#(Int(1), Int(2), Int(3))
|
||||
x#[Int(1)] = Int(0)
|
||||
}
|
||||
public? final? function foo(): <implicit> {
|
||||
return@@@foo Int(1)
|
||||
}
|
||||
public? final? function test2(): kotlin.Unit {
|
||||
public? final? function test2(): kotlin/Unit {
|
||||
val <array-set>: <implicit> = intArrayOf#(Int(1), Int(2), Int(3))
|
||||
<array-set>#[foo#()] = Int(1)
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,17 +1,17 @@
|
||||
FILE: callableReferences.kt
|
||||
public? final? class A {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
public? final? function foo(): kotlin.Unit {
|
||||
public? final? function foo(): kotlin/Unit {
|
||||
}
|
||||
|
||||
public? final? property bar(val): <implicit> = Int(0)
|
||||
public? get(): <implicit>
|
||||
|
||||
}
|
||||
public? final? function qux A.(): kotlin.Unit {
|
||||
public? final? function qux A.(): kotlin/Unit {
|
||||
}
|
||||
public? final? function baz(): kotlin.Unit {
|
||||
public? final? function baz(): kotlin/Unit {
|
||||
}
|
||||
public? final? property test1(val): <implicit> = A#()::foo#
|
||||
public? get(): <implicit>
|
||||
|
||||
@@ -9,17 +9,17 @@ FILE: calls.kt
|
||||
return@@@testRegular distance#(Int(3), Int(4))
|
||||
}
|
||||
public? final? class My {
|
||||
public? constructor(x: Int): super<kotlin.Any>()
|
||||
public? constructor(x: Int): super<kotlin/Any>()
|
||||
|
||||
public? final? property x(var): Int
|
||||
public? get(): Int
|
||||
public? set(value: Int): kotlin.Unit
|
||||
public? set(value: Int): kotlin/Unit
|
||||
|
||||
public? final? operator function invoke(): <implicit> {
|
||||
return@@@invoke x#
|
||||
}
|
||||
|
||||
public? final? function foo(): kotlin.Unit {
|
||||
public? final? function foo(): kotlin/Unit {
|
||||
}
|
||||
|
||||
public? final? function copy(): <implicit> {
|
||||
@@ -30,7 +30,7 @@ FILE: calls.kt
|
||||
public? final? function testInvoke(): Int {
|
||||
return@@@testInvoke invoke#(My#(Int(13)))
|
||||
}
|
||||
public? final? function testQualified(first: My, second: My?): kotlin.Unit {
|
||||
public? final? function testQualified(first: My, second: My?): kotlin/Unit {
|
||||
println#(first#.x#)
|
||||
println#(second#?.x#)
|
||||
first#.foo#()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
FILE: classReference.kt
|
||||
public? final? class A {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
public? final? function test(): kotlin.Unit {
|
||||
public? final? function test(): kotlin/Unit {
|
||||
<getClass>(A#)
|
||||
<getClass>(test#.A#)
|
||||
<getClass>(A#())
|
||||
|
||||
+7
-7
@@ -1,38 +1,38 @@
|
||||
FILE: collectionLiterals.kt
|
||||
public? final? annotation class Ann1 {
|
||||
public? constructor(arr: IntArray): super<kotlin.Any>()
|
||||
public? constructor(arr: IntArray): super<kotlin/Any>()
|
||||
|
||||
public? final? property arr(val): IntArray
|
||||
public? get(): IntArray
|
||||
|
||||
}
|
||||
public? final? annotation class Ann2 {
|
||||
public? constructor(arr: DoubleArray): super<kotlin.Any>()
|
||||
public? constructor(arr: DoubleArray): super<kotlin/Any>()
|
||||
|
||||
public? final? property arr(val): DoubleArray
|
||||
public? get(): DoubleArray
|
||||
|
||||
}
|
||||
public? final? annotation class Ann3 {
|
||||
public? constructor(arr: Array<String>): super<kotlin.Any>()
|
||||
public? constructor(arr: Array<String>): super<kotlin/Any>()
|
||||
|
||||
public? final? property arr(val): Array<String>
|
||||
public? get(): Array<String>
|
||||
|
||||
}
|
||||
@Ann1(<implicitArrayOf>()) @Ann2(<implicitArrayOf>()) @Ann3(<implicitArrayOf>()) public? final? class Zero {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
@Ann1(<implicitArrayOf>(Int(1), Int(2))) public? final? class First {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
@Ann2(<implicitArrayOf>(Double(3.14))) public? final? class Second {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
@Ann3(<implicitArrayOf>(String(Alpha), String(Omega))) public? final? class Third {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FILE: destructuring.kt
|
||||
public? final? data class Some {
|
||||
public? constructor(first: Int, second: Double, third: String): super<kotlin.Any>()
|
||||
public? constructor(first: Int, second: Double, third: String): super<kotlin/Any>()
|
||||
|
||||
public? final? property first(val): Int
|
||||
public? get(): Int
|
||||
@@ -12,7 +12,7 @@ FILE: destructuring.kt
|
||||
public? get(): String
|
||||
|
||||
}
|
||||
public? final? function foo(some: Some): kotlin.Unit {
|
||||
public? final? function foo(some: Some): kotlin/Unit {
|
||||
val <destruct>: <implicit> = some#
|
||||
var x: <implicit> = component1(<destruct>#)
|
||||
var y: <implicit> = component2(<destruct>#)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FILE: for.kt
|
||||
public? final? function foo(): kotlin.Unit {
|
||||
public? final? function foo(): kotlin/Unit {
|
||||
val <range>: <implicit> = rangeTo#(Int(1), Int(10))
|
||||
val <iterator>: <implicit> = <range>#.iterator#()
|
||||
while(<iterator>#.hasNext#()) {
|
||||
@@ -8,7 +8,7 @@ FILE: for.kt
|
||||
}
|
||||
|
||||
}
|
||||
public? final? function bar(list: List<String>): kotlin.Unit {
|
||||
public? final? function bar(list: List<String>): kotlin/Unit {
|
||||
val <range>: <implicit> = list#.subList#(Int(0), Int(10))
|
||||
val <iterator>: <implicit> = <range>#.iterator#()
|
||||
while(<iterator>#.hasNext#()) {
|
||||
@@ -25,7 +25,7 @@ FILE: for.kt
|
||||
|
||||
}
|
||||
public? final? data class Some {
|
||||
public? constructor(x: Int, y: Int): super<kotlin.Any>()
|
||||
public? constructor(x: Int, y: Int): super<kotlin/Any>()
|
||||
|
||||
public? final? property x(val): Int
|
||||
public? get(): Int
|
||||
@@ -34,7 +34,7 @@ FILE: for.kt
|
||||
public? get(): Int
|
||||
|
||||
}
|
||||
public? final? function baz(set: Set<Some>): kotlin.Unit {
|
||||
public? final? function baz(set: Set<Some>): kotlin/Unit {
|
||||
val <range>: <implicit> = set#
|
||||
val <iterator>: <implicit> = <range>#.iterator#()
|
||||
while(<iterator>#.hasNext#()) {
|
||||
|
||||
@@ -2,7 +2,7 @@ FILE: genericCalls.kt
|
||||
<T> public? final? function nullableValue(): T? {
|
||||
return@@@nullableValue Null(null)
|
||||
}
|
||||
public? final? function test(): kotlin.Unit {
|
||||
public? final? function test(): kotlin/Unit {
|
||||
val n: <implicit> = nullableValue#<Int>()
|
||||
val x: <implicit> = nullableValue#<Double>()
|
||||
val s: <implicit> = nullableValue#<String>()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FILE: init.kt
|
||||
public? final? class WithInit {
|
||||
public? constructor(x: Int): super<kotlin.Any>()
|
||||
public? constructor(x: Int): super<kotlin/Any>()
|
||||
|
||||
public? final? property x(val): Int
|
||||
public? get(): Int
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FILE: lambda.kt
|
||||
public? final? data class Tuple {
|
||||
public? constructor(x: Int, y: Int): super<kotlin.Any>()
|
||||
public? constructor(x: Int, y: Int): super<kotlin/Any>()
|
||||
|
||||
public? final? property x(val): Int
|
||||
public? get(): Int
|
||||
@@ -64,7 +64,7 @@ FILE: lambda.kt
|
||||
}
|
||||
)
|
||||
}
|
||||
public? final? function test(list: List<Int>): kotlin.Unit {
|
||||
public? final? function test(list: List<Int>): kotlin/Unit {
|
||||
val map: <implicit> = mutableMapOf#<Int, String>()
|
||||
list#.forEach#(forEach@function <implicit>.<anonymous>(): <implicit> {
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
FILE: locals.kt
|
||||
public? final? function withLocals(p: Int): Int {
|
||||
public? final? class Local {
|
||||
public? constructor(pp: Int): super<kotlin.Any>()
|
||||
public? constructor(pp: Int): super<kotlin/Any>()
|
||||
|
||||
public? final? property pp(val): Int
|
||||
public? get(): Int
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
FILE: modifications.kt
|
||||
public? final? function simple(): kotlin.Unit {
|
||||
public? final? function simple(): kotlin/Unit {
|
||||
var x: <implicit> = Int(10)
|
||||
x# += Int(20)
|
||||
x# -= Int(5)
|
||||
x# /= Int(5)
|
||||
x# *= Int(10)
|
||||
}
|
||||
public? final? function modify List<String>.(): kotlin.Unit {
|
||||
public? final? function modify List<String>.(): kotlin/Unit {
|
||||
this# += String(Alpha)
|
||||
this# += String(Omega)
|
||||
}
|
||||
public? final? function modify Any.(): kotlin.Unit {
|
||||
public? final? function modify Any.(): kotlin/Unit {
|
||||
val <complex-set>: <implicit> = as/List<Int>(this#)
|
||||
<complex-set># += Int(42)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FILE: simpleReturns.kt
|
||||
public? final? function foo(): kotlin.Unit {
|
||||
public? final? function foo(): kotlin/Unit {
|
||||
return@@@foo Unit
|
||||
}
|
||||
public? final? function bar(): String {
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
FILE: super.kt
|
||||
public? final? interface A {
|
||||
public? final? function foo(): kotlin.Unit {
|
||||
public? final? function foo(): kotlin/Unit {
|
||||
}
|
||||
|
||||
}
|
||||
public? final? interface B {
|
||||
public? final? function foo(): kotlin.Unit {
|
||||
public? final? function foo(): kotlin/Unit {
|
||||
}
|
||||
|
||||
public? final? function bar(): kotlin.Unit {
|
||||
public? final? function bar(): kotlin/Unit {
|
||||
}
|
||||
|
||||
}
|
||||
public? final? class C : A, B {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
public? open? override function bar(): kotlin.Unit {
|
||||
public? open? override function bar(): kotlin/Unit {
|
||||
super<<implicit>>.bar#()
|
||||
}
|
||||
|
||||
public? open? override function foo(): kotlin.Unit {
|
||||
public? open? override function foo(): kotlin/Unit {
|
||||
super<A>.foo#()
|
||||
super<B>.foo#()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
FILE: these.kt
|
||||
public? final? class Some {
|
||||
public? constructor(): super<kotlin.Any>()
|
||||
public? constructor(): super<kotlin/Any>()
|
||||
|
||||
public? final? function foo(): Int {
|
||||
return@@@foo Int(1)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FILE: try.kt
|
||||
public? final? function some(): kotlin.Unit {
|
||||
public? final? function some(): kotlin/Unit {
|
||||
try {
|
||||
throw KotlinNullPointerException#()
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FILE: unary.kt
|
||||
public? final? function test(): kotlin.Unit {
|
||||
public? final? function test(): kotlin/Unit {
|
||||
var x: <implicit> = Int(0)
|
||||
val x1: <implicit> = {
|
||||
val <unary>: <implicit> = x#
|
||||
@@ -35,13 +35,13 @@ FILE: unary.kt
|
||||
|
||||
}
|
||||
public? final? class X {
|
||||
public? constructor(i: Int): super<kotlin.Any>()
|
||||
public? constructor(i: Int): super<kotlin/Any>()
|
||||
|
||||
public? final? property i(val): Int
|
||||
public? get(): Int
|
||||
|
||||
}
|
||||
public? final? function test2(x: X): kotlin.Unit {
|
||||
public? final? function test2(x: X): kotlin/Unit {
|
||||
val x1: <implicit> = {
|
||||
val <unary>: <implicit> = x#.i#
|
||||
x#.i# = inc#(<unary>#)
|
||||
@@ -56,7 +56,7 @@ FILE: unary.kt
|
||||
}
|
||||
|
||||
}
|
||||
public? final? function test3(arr: Array<Int>): kotlin.Unit {
|
||||
public? final? function test3(arr: Array<Int>): kotlin/Unit {
|
||||
val x1: <implicit> = {
|
||||
val <unary>: <implicit> = arr#[Int(0)]
|
||||
arr#[Int(0)] = inc#(<unary>#)
|
||||
@@ -72,13 +72,13 @@ FILE: unary.kt
|
||||
|
||||
}
|
||||
public? final? class Y {
|
||||
public? constructor(arr: Array<Int>): super<kotlin.Any>()
|
||||
public? constructor(arr: Array<Int>): super<kotlin/Any>()
|
||||
|
||||
public? final? property arr(val): Array<Int>
|
||||
public? get(): Array<Int>
|
||||
|
||||
}
|
||||
public? final? function test4(y: Y): kotlin.Unit {
|
||||
public? final? function test4(y: Y): kotlin/Unit {
|
||||
val x1: <implicit> = {
|
||||
val <unary>: <implicit> = y#.arr#[Int(0)]
|
||||
val <array-set>: <implicit> = y#.arr#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FILE: variables.kt
|
||||
public? final? function foo(): kotlin.Unit {
|
||||
public? final? function foo(): kotlin/Unit {
|
||||
val x: <implicit> = Int(1)
|
||||
var y: <implicit> = plus#(x#, Int(1))
|
||||
val z: <implicit> = times#(y#, Int(2))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
FILE: while.kt
|
||||
public? final? function foo(limit: Int): kotlin.Unit {
|
||||
public? final? function foo(limit: Int): kotlin/Unit {
|
||||
var k: <implicit> = Int(0)
|
||||
some@while(<(k#, limit#)) {
|
||||
val <unary>: <implicit> = k#
|
||||
@@ -31,7 +31,7 @@ FILE: while.kt
|
||||
}
|
||||
|
||||
}
|
||||
public? final? function bar(limit: Int): kotlin.Unit {
|
||||
public? final? function bar(limit: Int): kotlin/Unit {
|
||||
var k: <implicit> = limit#
|
||||
do {
|
||||
val <unary>: <implicit> = k#
|
||||
|
||||
+22
-16
@@ -5,17 +5,21 @@
|
||||
|
||||
package org.jetbrains.kotlin.fir.resolve.impl
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.expandedConeType
|
||||
import org.jetbrains.kotlin.fir.render
|
||||
import org.jetbrains.kotlin.fir.resolve.FirQualifierResolver
|
||||
import org.jetbrains.kotlin.fir.resolve.FirSymbolProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.FirTypeResolver
|
||||
import org.jetbrains.kotlin.fir.scopes.FirPosition
|
||||
import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||
import org.jetbrains.kotlin.fir.service
|
||||
import org.jetbrains.kotlin.fir.symbols.*
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol
|
||||
import org.jetbrains.kotlin.fir.types.*
|
||||
import org.jetbrains.kotlin.fir.types.impl.*
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
class FirTypeResolverImpl : FirTypeResolver {
|
||||
@@ -58,9 +62,17 @@ class FirTypeResolverImpl : FirTypeResolver {
|
||||
}
|
||||
}
|
||||
|
||||
private data class NameInSession(val session: FirSession, val name: Name)
|
||||
private data class ClassIdInSession(val session: FirSession, val id: ClassId)
|
||||
|
||||
private val implicitBuiltinTypeSymbols = mutableMapOf<NameInSession, ConeSymbol>()
|
||||
private val implicitBuiltinTypeSymbols = mutableMapOf<ClassIdInSession, ConeClassLikeSymbol>()
|
||||
|
||||
|
||||
private fun resolveBuiltInQualified(id: ClassId, session: FirSession): ConeClassLikeSymbol {
|
||||
val nameInSession = ClassIdInSession(session, id)
|
||||
return implicitBuiltinTypeSymbols.getOrPut(nameInSession) {
|
||||
session.service<FirSymbolProvider>().getClassLikeSymbolByFqName(id)!!
|
||||
}
|
||||
}
|
||||
|
||||
override fun resolveToSymbol(
|
||||
typeRef: FirTypeRef,
|
||||
@@ -96,23 +108,16 @@ class FirTypeResolverImpl : FirTypeResolver {
|
||||
resolvedSymbol ?: qualifierResolver.resolveSymbol(typeRef.qualifier)
|
||||
}
|
||||
is FirImplicitBuiltinTypeRef -> {
|
||||
val nameInSession = NameInSession(typeRef.session, typeRef.name)
|
||||
implicitBuiltinTypeSymbols[nameInSession] ?: run {
|
||||
var resolvedSymbol: ConeSymbol? = null
|
||||
scope.processClassifiersByName(typeRef.name, position) {
|
||||
resolvedSymbol = (it as ConeClassLikeSymbol)
|
||||
resolvedSymbol == null
|
||||
}
|
||||
implicitBuiltinTypeSymbols[nameInSession] = resolvedSymbol!!
|
||||
resolvedSymbol
|
||||
}
|
||||
resolveBuiltInQualified(typeRef.id, typeRef.session)
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
override fun resolveUserType(typeRef: FirUserTypeRef, symbol: ConeSymbol?, scope: FirScope): ConeKotlinType {
|
||||
symbol ?: return ConeKotlinErrorType("Symbol not found")
|
||||
symbol ?: return ConeKotlinErrorType("Symbol not found, for `${typeRef.render()}`")
|
||||
return symbol.toConeKotlinType(typeRef.qualifier) ?: ConeKotlinErrorType("Failed to resolve qualified type")
|
||||
}
|
||||
|
||||
@@ -132,8 +137,9 @@ class FirTypeResolverImpl : FirTypeResolver {
|
||||
is FirFunctionTypeRef -> {
|
||||
ConeFunctionTypeImpl(
|
||||
(typeRef.receiverTypeRef as FirResolvedTypeRef?)?.type,
|
||||
typeRef.valueParameters.map { it.returnTypeRef.coneTypeUnsafe<ConeKotlinType>() },
|
||||
typeRef.returnTypeRef.coneTypeUnsafe()
|
||||
typeRef.valueParameters.map { it.returnTypeRef.coneTypeUnsafe() },
|
||||
typeRef.returnTypeRef.coneTypeUnsafe(),
|
||||
resolveBuiltInQualified(KotlinBuiltIns.getFunctionClassId(typeRef.parametersCount), typeRef.session)
|
||||
)
|
||||
}
|
||||
is FirImplicitBuiltinTypeRef -> {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FILE: fakeRecursiveTypealias.kt
|
||||
public final typealias My = R|error: Symbol not found|
|
||||
public final typealias My = R|error: Symbol not found, for `incorrect.directory.My`|
|
||||
public final typealias Your = R|error: Recursion detected: Your|
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
FILE: ft.kt
|
||||
<T> public abstract interface KMutableProperty1 : R|KProperty1<T>| {
|
||||
}
|
||||
<T> public abstract interface KProperty1 : R|(T) -> kotlin/Int| {
|
||||
<T> public abstract interface KProperty1 : R|kotlin/Function1| {
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,15 +1,15 @@
|
||||
FILE: functionTypes.kt
|
||||
<T> public final function simpleRun(f: R|(T) -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
<T> public final function simpleRun(f: R|kotlin/Function1|): R|kotlin/Unit| {
|
||||
return@@@simpleRun <Unresolved name: f>#()
|
||||
}
|
||||
<T, R> public final function simpleMap R|kotlin/collections/List<T>|.(f: R|(T) -> R|): R|R| {
|
||||
<T, R> public final function simpleMap R|kotlin/collections/List<T>|.(f: R|kotlin/Function1|): R|R| {
|
||||
}
|
||||
<T> public final function simpleWith(t: R|T|, f: R|T.() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
<T> public final function simpleWith(t: R|T|, f: R|kotlin/Function1|): R|kotlin/Unit| {
|
||||
return@@@simpleWith <Unresolved name: t>#.<Unresolved name: f>#()
|
||||
}
|
||||
<T, R> public abstract interface KMutableProperty1 : R|KProperty1<T, R>|, R|KMutableProperty<R>| {
|
||||
}
|
||||
<T, out R> public abstract interface KProperty1 : R|KProperty<R>|, R|(T) -> R| {
|
||||
<T, out R> public abstract interface KProperty1 : R|KProperty<R>|, R|kotlin/Function1| {
|
||||
}
|
||||
<out R> public abstract interface KProperty {
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ FILE: genericFunctions.kt
|
||||
return@@@safeAs as?/R|T|(this#)
|
||||
}
|
||||
public abstract class Summator {
|
||||
public constructor(): super<R|Any|>()
|
||||
public constructor(): super<R|kotlin/Any|>()
|
||||
|
||||
<T> public abstract function plus(first: R|T|, second: R|T|): R|T|
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ FILE: sealedStarImport.kt
|
||||
public abstract class Factory {
|
||||
public constructor(): super<R|kotlin/Any|>()
|
||||
|
||||
public abstract function createTest(): R|error: Symbol not found|
|
||||
public abstract function createTest(): R|error: Symbol not found, for `Test`|
|
||||
|
||||
public abstract function createObj(): R|test/Test.O|
|
||||
|
||||
|
||||
@@ -579,7 +579,7 @@ class FirRenderer(builder: StringBuilder) : FirVisitorVoid() {
|
||||
}
|
||||
|
||||
override fun visitImplicitTypeRef(implicitTypeRef: FirImplicitTypeRef) {
|
||||
print(if (implicitTypeRef is FirImplicitBuiltinTypeRef) "kotlin.${implicitTypeRef.name}" else "<implicit>")
|
||||
print(if (implicitTypeRef is FirImplicitBuiltinTypeRef) "${implicitTypeRef.id}" else "<implicit>")
|
||||
}
|
||||
|
||||
override fun visitTypeRefWithNullability(typeRefWithNullability: FirTypeRefWithNullability) {
|
||||
|
||||
@@ -27,4 +27,11 @@ interface FirFunctionTypeRef : FirTypeRefWithNullability {
|
||||
parameter.accept(visitor, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
val FirFunctionTypeRef.parametersCount: Int
|
||||
get() = if (receiverTypeRef != null)
|
||||
valueParameters.size + 1
|
||||
else
|
||||
valueParameters.size
|
||||
+3
-2
@@ -10,18 +10,19 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||
import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqNameUnsafe
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
sealed class FirImplicitBuiltinTypeRef(
|
||||
override val session: FirSession,
|
||||
override val psi: PsiElement?,
|
||||
val name: Name
|
||||
val id: ClassId
|
||||
) : FirImplicitTypeRef {
|
||||
override val annotations: List<FirAnnotationCall>
|
||||
get() = emptyList()
|
||||
|
||||
constructor(session: FirSession, psi: PsiElement?, name: FqNameUnsafe) : this(session, psi, name.shortName())
|
||||
constructor(session: FirSession, psi: PsiElement?, name: FqNameUnsafe) : this(session, psi, ClassId.topLevel(name.toSafe()))
|
||||
}
|
||||
|
||||
class FirImplicitUnitTypeRef(
|
||||
|
||||
Reference in New Issue
Block a user