FIR: Fix overloading by type-arguments
In K1, upper bound violated causes candidate to have lower applicability due to constraint errors, in K2 however constraint errors has to be reported explicitly
This commit is contained in:
+2
-2
@@ -61,8 +61,8 @@ FILE: multipleBounds.kt
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
<CS errors: Jet87/Test1.Test1>#<R|Jet87/B|>()
|
||||
<CS errors: Jet87/Test1.Test1>#<R|Jet87/A|>()
|
||||
<Inapplicable(INAPPLICABLE): Jet87/Test1.Test1>#<R|Jet87/B|>()
|
||||
<Inapplicable(INAPPLICABLE): Jet87/Test1.Test1>#<R|Jet87/A|>()
|
||||
R|Jet87/Test1.Test1|<R|Jet87/C|>()
|
||||
}
|
||||
public final class Foo : R|kotlin/Any| {
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ FILE: typeArgumentsNotAllowed.kt
|
||||
|
||||
}
|
||||
public final fun <T> foo(): R|kotlin/Unit| {
|
||||
<CS errors: rest/bar>#<<ERROR TYPE REF: Type arguments not allowed>>()
|
||||
<Inapplicable(INAPPLICABLE): rest/bar>#<<ERROR TYPE REF: Type arguments not allowed>>()
|
||||
R|rest/bar|<R|kotlin/collections/List<kotlin/collections/List<ERROR CLASS: Type arguments not allowed>>|>()
|
||||
}
|
||||
public final fun <T> bar(): R|kotlin/Unit| {
|
||||
@@ -44,7 +44,7 @@ FILE: typeArgumentsNotAllowed.kt
|
||||
}
|
||||
public final fun <T> fest(): R|kotlin/Unit| {
|
||||
lval b: R|kotlin/collections/List<ERROR CLASS: Type arguments not allowed>|
|
||||
<CS errors: rest/gest>#<<ERROR TYPE REF: Type arguments not allowed>>()
|
||||
<Inapplicable(INAPPLICABLE): rest/gest>#<<ERROR TYPE REF: Type arguments not allowed>>()
|
||||
R|rest/gest|<R|T|>()
|
||||
lval c: R|kotlin/collections/List<kotlin/collections/List<kotlin/collections/List<ERROR CLASS: Type arguments not allowed>>>|
|
||||
R|rest/gest|<R|kotlin/collections/List<kotlin/collections/List<ERROR CLASS: Type arguments not allowed>>|>()
|
||||
|
||||
+9
-9
@@ -19,15 +19,15 @@ FILE: upperBoundViolated.kt
|
||||
public final fun <T : R|A|> fest(): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval b1: R|B<kotlin/Int>| = <CS errors: /B.B>#<R|kotlin/Int|>()
|
||||
lval b1: R|B<kotlin/Int>| = <Inapplicable(INAPPLICABLE): /B.B>#<R|kotlin/Int|>()
|
||||
lval b2: R|B<C>| = R|/B.B|<R|C|>()
|
||||
lval b3: R|B<kotlin/Any?>| = <CS errors: /B.B>#<R|kotlin/Any?|>()
|
||||
lval b4: <ERROR TYPE REF: Unresolved name: NumberPhile> = <CS errors: /B.B>#<<ERROR TYPE REF: Symbol not found for UnexistingType>>().<Unresolved name: NL>#(ERROR_EXPR(No right operand)).<Unresolved name: Int>#(<Call has no callee>#()).<Unresolved name: NumberPhile>#(ERROR_EXPR(No right operand))
|
||||
lval b5: R|B<B<ERROR CLASS: Symbol not found for UnexistingType>>| = <CS errors: /B.B>#<R|B<ERROR CLASS: Symbol not found for UnexistingType>|>()
|
||||
<CS errors: /fest>#<R|kotlin/Boolean|>()
|
||||
lval b3: R|B<kotlin/Any?>| = <Inapplicable(INAPPLICABLE): /B.B>#<R|kotlin/Any?|>()
|
||||
lval b4: <ERROR TYPE REF: Unresolved name: NumberPhile> = <Inapplicable(INAPPLICABLE): /B.B>#<<ERROR TYPE REF: Symbol not found for UnexistingType>>().<Unresolved name: NL>#(ERROR_EXPR(No right operand)).<Unresolved name: Int>#(<Call has no callee>#()).<Unresolved name: NumberPhile>#(ERROR_EXPR(No right operand))
|
||||
lval b5: R|B<B<ERROR CLASS: Symbol not found for UnexistingType>>| = <Inapplicable(INAPPLICABLE): /B.B>#<R|B<ERROR CLASS: Symbol not found for UnexistingType>|>()
|
||||
<Inapplicable(INAPPLICABLE): /fest>#<R|kotlin/Boolean|>()
|
||||
R|/fest|<R|C|>()
|
||||
R|/fest|<R|C|>()
|
||||
<CS errors: /fest>#<R|B<C>|>()
|
||||
<Inapplicable(INAPPLICABLE): /fest>#<R|B<C>|>()
|
||||
}
|
||||
public open class S<F, G : R|F|> : R|kotlin/Any| {
|
||||
public constructor<F, G : R|F|>(): R|S<F, G>| {
|
||||
@@ -58,11 +58,11 @@ FILE: upperBoundViolated.kt
|
||||
lval o2: R|S<K, K>| = R|/S.S|<R|K|, R|K|>()
|
||||
lval o3: R|S<L, L>| = R|/S.S|<R|L|, R|L|>()
|
||||
lval o4: R|S<S<K, L>, T<K, L>>| = R|/S.S|<R|S<K, L>|, R|T<K, L>|>()
|
||||
lval o5: R|S<S<K, L>, T<K, K>>| = <CS errors: /S.S>#<R|S<K, L>|, R|T<K, K>|>()
|
||||
lval o5: R|S<S<L, L>, T<K, L>>| = <CS errors: /S.S>#<R|S<L, L>|, R|T<K, L>|>()
|
||||
lval o5: R|S<S<K, L>, T<K, K>>| = <Inapplicable(INAPPLICABLE): /S.S>#<R|S<K, L>|, R|T<K, K>|>()
|
||||
lval o5: R|S<S<L, L>, T<K, L>>| = <Inapplicable(INAPPLICABLE): /S.S>#<R|S<L, L>|, R|T<K, L>|>()
|
||||
lval o6: R|S<kotlin/Any, T<S<K, L>, kotlin/String>>| = R|/S.S|<R|kotlin/Any|, R|T<S<K, L>, kotlin/String>|>()
|
||||
lval o7: R|S<kotlin/Any, T<S<K, L>, kotlin/Nothing>>| = R|/S.S|<R|kotlin/Any|, R|T<S<K, L>, kotlin/Nothing>|>()
|
||||
lval o8: R|P<kotlin/String, P1<kotlin/String, kotlin/String>>| = <CS errors: /P.P>#<R|kotlin/String|, R|P1<kotlin/String, kotlin/String>|>()
|
||||
lval o8: R|P<kotlin/String, P1<kotlin/String, kotlin/String>>| = <Inapplicable(INAPPLICABLE): /P.P>#<R|kotlin/String|, R|P1<kotlin/String, kotlin/String>|>()
|
||||
}
|
||||
public final class NumColl<T : R|kotlin/collections/Collection<kotlin/Number>|> : R|kotlin/Any| {
|
||||
public constructor<T : R|kotlin/collections/Collection<kotlin/Number>|>(): R|NumColl<T>| {
|
||||
|
||||
@@ -32,6 +32,6 @@ import classes.foo.*
|
||||
fun <T> foo() {}
|
||||
|
||||
fun test() {
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>nameOf<!><Bar>()
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>nameOf<!><Foo>()
|
||||
nameOf<Bar>()
|
||||
nameOf<Foo>()
|
||||
}
|
||||
|
||||
+6
@@ -79,6 +79,12 @@ internal object CreateFreshTypeVariableSubstitutorStage : ResolutionStage() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (csBuilder.hasContradiction) {
|
||||
for (error in csBuilder.errors) {
|
||||
sink.reportDiagnostic(InferenceError(error))
|
||||
}
|
||||
sink.yieldIfNeed()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ fun test() {
|
||||
bar<Int>()
|
||||
bar<<!UPPER_BOUND_VIOLATED!>Double?<!>>()
|
||||
bar<<!UPPER_BOUND_VIOLATED!>Double<!>>()
|
||||
1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>buzz<!><Double>()
|
||||
1.buzz<<!UPPER_BOUND_VIOLATED!>Double<!>>()
|
||||
}
|
||||
|
||||
fun <T : Any> foo() {}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ fun test5() {
|
||||
fun <R: Any> R?.sure() : R = this!!
|
||||
|
||||
fun <T> test6(l: List<T>?) {
|
||||
l.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>sure<!><T>()
|
||||
l.sure<<!UPPER_BOUND_VIOLATED!>T<!>>()
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -13,6 +13,6 @@ fun <F : String?> bar(x: F) {
|
||||
foo1<<!UPPER_BOUND_VIOLATED!>F<!>>(<!ARGUMENT_TYPE_MISMATCH!>x<!>)
|
||||
|
||||
x<!UNSAFE_CALL!>.<!>foo2()
|
||||
x.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo2<!><F>()
|
||||
x.foo2<<!UPPER_BOUND_VIOLATED!>F<!>>()
|
||||
}
|
||||
|
||||
|
||||
@@ -9,4 +9,4 @@ fun <T, Q> List<T>.map1(f: (T)-> Q): List<T>? = tail!!.map1(f)
|
||||
|
||||
fun <T, Q> List<T>.map2(f: (T)-> Q): List<T>? = tail.sure().map2(f)
|
||||
|
||||
fun <T, Q> List<T>.map3(f: (T)-> Q): List<T>? = tail.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>sure<!><T>().<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>map3<!>(f)
|
||||
fun <T, Q> List<T>.map3(f: (T)-> Q): List<T>? = tail.sure<<!UPPER_BOUND_VIOLATED!>T<!>>().<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>map3<!>(f)
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ fun foo() {
|
||||
import test.E as U
|
||||
|
||||
fun bar() {
|
||||
U.Entry checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><<!UNRESOLVED_REFERENCE!>E<!>>() }
|
||||
U.Entry checkType { _<<!UNRESOLVED_REFERENCE!>E<!>>() }
|
||||
U.Entry checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String>() }
|
||||
U.Companion.Entry checkType { _<String>() }
|
||||
U.NotEntry checkType { _<String>() }
|
||||
|
||||
Reference in New Issue
Block a user