K2: Don't use FirTypeParameterSymbol.resolvedBounds() from inference
This commit is contained in:
committed by
Space Team
parent
e57521ed23
commit
df5aa59185
+9
@@ -0,0 +1,9 @@
|
||||
open class Foo<T : CharSequence>
|
||||
|
||||
fun bar(): Foo<String>? {
|
||||
return null
|
||||
}
|
||||
|
||||
fun resolveMe() {
|
||||
val x = bar()
|
||||
}
|
||||
Vendored
+170
@@ -0,0 +1,170 @@
|
||||
|
||||
RAW_FIR:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
IMPORTS:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
COMPILER_REQUIRED_ANNOTATIONS:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
COMPANION_GENERATION:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public? final? [COMPANION_GENERATION] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
SUPER_TYPES:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public? final? [SUPER_TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
TYPES:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public? final? [TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
STATUS:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public final [STATUS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
ARGUMENTS_OF_ANNOTATIONS:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public final [ARGUMENTS_OF_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
CONTRACTS:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public final [CONTRACTS] fun resolveMe(): R|kotlin/Unit| {
|
||||
[RAW_FIR] lval x: <implicit> = bar#()
|
||||
}
|
||||
|
||||
IMPLICIT_TYPES_BODY_RESOLVE:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public final [IMPLICIT_TYPES_BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
|
||||
[RAW_FIR] lval x: <implicit> = bar#()
|
||||
}
|
||||
|
||||
ANNOTATIONS_ARGUMENTS_MAPPING:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public final [ANNOTATIONS_ARGUMENTS_MAPPING] fun resolveMe(): R|kotlin/Unit| {
|
||||
[RAW_FIR] lval x: <implicit> = bar#()
|
||||
}
|
||||
|
||||
EXPECT_ACTUAL_MATCHING:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): Foo<String>? { LAZY_BLOCK }
|
||||
public final [EXPECT_ACTUAL_MATCHING] fun resolveMe(): R|kotlin/Unit| {
|
||||
[RAW_FIR] lval x: <implicit> = bar#()
|
||||
}
|
||||
|
||||
BODY_RESOLVE:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public? open [COMPILER_REQUIRED_ANNOTATIONS] class Foo<[COMPILER_REQUIRED_ANNOTATIONS] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [COMPILER_REQUIRED_ANNOTATIONS] [ContainingClassKey=Foo] constructor<[COMPILER_REQUIRED_ANNOTATIONS] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final [CONTRACTS] fun bar(): R|Foo<kotlin/String>?| {
|
||||
^bar Null(null)
|
||||
}
|
||||
public final [BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
|
||||
[BODY_RESOLVE] lval x: R|Foo<kotlin/String>?| = R|/bar|()
|
||||
}
|
||||
|
||||
FILE RAW TO BODY:
|
||||
FILE: functionCallWithGenericResult.kt
|
||||
public open [BODY_RESOLVE] class Foo<[BODY_RESOLVE] T : R|kotlin/CharSequence|> : R|kotlin/Any| {
|
||||
public [BODY_RESOLVE] [ContainingClassKey=Foo] constructor<[BODY_RESOLVE] T : R|kotlin/CharSequence|>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final [BODY_RESOLVE] fun bar(): R|Foo<kotlin/String>?| {
|
||||
^bar Null(null)
|
||||
}
|
||||
public final [BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
|
||||
[BODY_RESOLVE] lval x: R|Foo<kotlin/String>?| = R|/bar|()
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
open class Foo<T : CharSequence>
|
||||
|
||||
class Bar : Foo<String>
|
||||
|
||||
fun bar() = Bar()
|
||||
|
||||
fun resolveMe() {
|
||||
val x: Foo<String> = bar()
|
||||
}
|
||||
Vendored
+253
@@ -0,0 +1,253 @@
|
||||
RAW_FIR:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
IMPORTS:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public? final? [RAW_FIR] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
COMPILER_REQUIRED_ANNOTATIONS:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public? final? [COMPILER_REQUIRED_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
COMPANION_GENERATION:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public? final? [COMPANION_GENERATION] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
SUPER_TYPES:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public? final? [SUPER_TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
TYPES:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public? final? [TYPES] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
STATUS:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public final [STATUS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
ARGUMENTS_OF_ANNOTATIONS:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public final [ARGUMENTS_OF_ANNOTATIONS] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
CONTRACTS:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public final [CONTRACTS] fun resolveMe(): R|kotlin/Unit| {
|
||||
[RAW_FIR] lval x: Foo<String> = bar#()
|
||||
}
|
||||
|
||||
IMPLICIT_TYPES_BODY_RESOLVE:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public final [IMPLICIT_TYPES_BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
|
||||
[RAW_FIR] lval x: Foo<String> = bar#()
|
||||
}
|
||||
|
||||
ANNOTATIONS_ARGUMENTS_MAPPING:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public final [ANNOTATIONS_ARGUMENTS_MAPPING] fun resolveMe(): R|kotlin/Unit| {
|
||||
[RAW_FIR] lval x: Foo<String> = bar#()
|
||||
}
|
||||
|
||||
EXPECT_ACTUAL_MATCHING:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public? open [RAW_FIR] class Foo<[RAW_FIR] T : CharSequence> : R|kotlin/Any| {
|
||||
public? [RAW_FIR] [ContainingClassKey=Foo] constructor<[RAW_FIR] T : CharSequence>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] class Bar : Foo<String> {
|
||||
public? [RAW_FIR] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public? final? [RAW_FIR] fun bar(): <implicit> { LAZY_BLOCK }
|
||||
public final [EXPECT_ACTUAL_MATCHING] fun resolveMe(): R|kotlin/Unit| {
|
||||
[RAW_FIR] lval x: Foo<String> = bar#()
|
||||
}
|
||||
|
||||
BODY_RESOLVE:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public open [TYPES] class Foo<[TYPES] T : R|kotlin/CharSequence|> : R|kotlin/Any| {
|
||||
public [TYPES] [ContainingClassKey=Foo] constructor<[TYPES] T : R|kotlin/CharSequence|>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final [TYPES] class Bar : R|Foo<kotlin/String>| {
|
||||
public [STATUS] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<<implicit>>()
|
||||
}
|
||||
|
||||
}
|
||||
public final [IMPLICIT_TYPES_BODY_RESOLVE] fun bar(): R|Bar| {
|
||||
^bar R|/Bar.Bar|()
|
||||
}
|
||||
public final [BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
|
||||
[BODY_RESOLVE] lval x: R|Foo<kotlin/String>| = R|/bar|()
|
||||
}
|
||||
|
||||
FILE RAW TO BODY:
|
||||
FILE: functionWithGenericExpectedTypeInside.kt
|
||||
public open [BODY_RESOLVE] class Foo<[BODY_RESOLVE] T : R|kotlin/CharSequence|> : R|kotlin/Any| {
|
||||
public [BODY_RESOLVE] [ContainingClassKey=Foo] constructor<[BODY_RESOLVE] T : R|kotlin/CharSequence|>(): R|Foo<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final [BODY_RESOLVE] class Bar : R|Foo<kotlin/String>| {
|
||||
public [BODY_RESOLVE] [ContainingClassKey=Bar] constructor(): R|Bar| {
|
||||
super<R|Foo<kotlin/String>|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final [BODY_RESOLVE] fun bar(): R|Bar| {
|
||||
^bar R|/Bar.Bar|()
|
||||
}
|
||||
public final [BODY_RESOLVE] fun resolveMe(): R|kotlin/Unit| {
|
||||
[BODY_RESOLVE] lval x: R|Foo<kotlin/String>| = R|/bar|()
|
||||
}
|
||||
+12
@@ -191,6 +191,18 @@ public class FirLazyDeclarationResolveTestGenerated extends AbstractFirLazyDecla
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/functions"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionCallWithGenericResult.kt")
|
||||
public void testFunctionCallWithGenericResult() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testdata/lazyResolve/functions/functionCallWithGenericResult.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionWithGenericExpectedTypeInside.kt")
|
||||
public void testFunctionWithGenericExpectedTypeInside() throws Exception {
|
||||
runTest("analysis/low-level-api-fir/testdata/lazyResolve/functions/functionWithGenericExpectedTypeInside.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("functionWithTypeParameters.kt")
|
||||
public void testFunctionWithTypeParameters() throws Exception {
|
||||
|
||||
@@ -281,7 +281,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
return when (this) {
|
||||
is ConeStubTypeConstructor -> listOf(session.builtinTypes.nullableAnyType.type)
|
||||
is ConeTypeVariableTypeConstructor -> emptyList()
|
||||
is ConeTypeParameterLookupTag -> symbol.resolvedBounds.map { it.coneType }
|
||||
is ConeTypeParameterLookupTag -> bounds().map { it.coneType }
|
||||
is ConeClassLikeLookupTag -> {
|
||||
when (val symbol = toClassLikeSymbol().also { it?.lazyResolveToPhase(FirResolvePhase.TYPES) }) {
|
||||
is FirClassSymbol<*> -> symbol.fir.superConeTypes
|
||||
@@ -315,17 +315,17 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
|
||||
override fun TypeParameterMarker.upperBoundCount(): Int {
|
||||
require(this is ConeTypeParameterLookupTag)
|
||||
return this.symbol.resolvedBounds.size
|
||||
return this.bounds().size
|
||||
}
|
||||
|
||||
override fun TypeParameterMarker.getUpperBound(index: Int): KotlinTypeMarker {
|
||||
require(this is ConeTypeParameterLookupTag)
|
||||
return this.symbol.resolvedBounds[index].coneType
|
||||
return this.bounds()[index].coneType
|
||||
}
|
||||
|
||||
override fun TypeParameterMarker.getUpperBounds(): List<KotlinTypeMarker> {
|
||||
require(this is ConeTypeParameterLookupTag)
|
||||
return this.symbol.resolvedBounds.map { it.coneType }
|
||||
return this.bounds().map { it.coneType }
|
||||
}
|
||||
|
||||
override fun TypeParameterMarker.getTypeConstructor(): TypeConstructorMarker {
|
||||
@@ -335,7 +335,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
|
||||
override fun TypeParameterMarker.hasRecursiveBounds(selfConstructor: TypeConstructorMarker?): Boolean {
|
||||
require(this is ConeTypeParameterLookupTag)
|
||||
return this.typeParameterSymbol.resolvedBounds.any { typeRef ->
|
||||
return this.bounds().any { typeRef ->
|
||||
typeRef.coneType.contains { it.typeConstructor() == this.getTypeConstructor() }
|
||||
&& (selfConstructor == null || typeRef.coneType.typeConstructor() == selfConstructor)
|
||||
}
|
||||
@@ -580,10 +580,13 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
|
||||
override fun TypeParameterMarker.getRepresentativeUpperBound(): KotlinTypeMarker {
|
||||
require(this is ConeTypeParameterLookupTag)
|
||||
return this.symbol.resolvedBounds.getOrNull(0)?.coneType
|
||||
return this.bounds().getOrNull(0)?.coneType
|
||||
?: session.builtinTypes.nullableAnyType.type
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
private inline fun ConeTypeParameterLookupTag.bounds(): List<FirTypeRef> = symbol.fir.bounds
|
||||
|
||||
override fun KotlinTypeMarker.getUnsubstitutedUnderlyingType(): KotlinTypeMarker? {
|
||||
require(this is ConeKotlinType)
|
||||
return unsubstitutedUnderlyingTypeForInlineClass(session)
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.fir.resolve.toSymbol
|
||||
import org.jetbrains.kotlin.fir.resolvedTypeFromPrototype
|
||||
import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||
import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase
|
||||
import org.jetbrains.kotlin.fir.types.builder.*
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
|
||||
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
|
||||
@@ -394,6 +395,7 @@ fun ConeTypeContext.captureArguments(type: ConeKotlinType, status: CaptureStatus
|
||||
if (oldArgument.kind == ProjectionKind.INVARIANT) continue
|
||||
|
||||
val parameter = typeConstructor.getParameter(index)
|
||||
(parameter as? ConeTypeParameterLookupTag)?.typeParameterSymbol?.lazyResolveToPhase(FirResolvePhase.TYPES)
|
||||
val upperBounds = (0 until parameter.upperBoundCount()).mapTo(mutableListOf()) { paramIndex ->
|
||||
substitutor.safeSubstitute(
|
||||
this as TypeSystemInferenceExtensionContext, parameter.getUpperBound(paramIndex)
|
||||
|
||||
Reference in New Issue
Block a user