[Analysis API] KTIJ-24527 Properly handle typealiased functional types
Use expanded ConeTypes to get correct parameters and return types Also, fix the order of rendering modifiers in `KtFunctionalTypeRenderer` ^KTIJ-24527 Fixed
This commit is contained in:
+4
-4
@@ -25,13 +25,13 @@ public interface KtFunctionalTypeRenderer {
|
||||
if (annotationsRendered || type.nullability == KtTypeNullability.NULLABLE) append("(")
|
||||
" ".separated(
|
||||
{
|
||||
if (type.hasContextReceivers) {
|
||||
contextReceiversRenderer.renderContextReceivers(type, printer)
|
||||
if (type.isSuspend) {
|
||||
keywordRenderer.renderKeyword(KtTokens.SUSPEND_KEYWORD, type, printer)
|
||||
}
|
||||
},
|
||||
{
|
||||
if (type.isSuspend) {
|
||||
keywordRenderer.renderKeyword(KtTokens.SUSPEND_KEYWORD, type, printer)
|
||||
if (type.hasContextReceivers) {
|
||||
contextReceiversRenderer.renderContextReceivers(type, printer)
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
class A
|
||||
class B
|
||||
|
||||
typealias WithGeneric<T> = (T) -> String
|
||||
fun withGeneric(f: WithGeneric<Double>) {}
|
||||
|
||||
typealias WithReceiver = String.() -> Unit
|
||||
fun withReceiver(f: WithReceiver) {}
|
||||
|
||||
typealias WithContextReceiver = context(String) () -> Unit
|
||||
fun withContextReceiver(f: WithContextReceiver) {}
|
||||
|
||||
typealias WithSuspend = suspend (String) -> Int
|
||||
fun withContextReceiver(f: WithSuspend) {}
|
||||
|
||||
typealias WithEverything<T> = suspend context(T, B) String.(Int, T) -> String
|
||||
fun withEverything(f: WithEverything<A>) {}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
class A
|
||||
|
||||
class B
|
||||
|
||||
typealias WithGeneric<T> = (T) -> String
|
||||
|
||||
fun withGeneric(f: (Double) -> String)
|
||||
|
||||
typealias WithReceiver = String.() -> Unit
|
||||
|
||||
fun withReceiver(f: String.() -> Unit)
|
||||
|
||||
typealias WithContextReceiver = context(String) () -> Unit
|
||||
|
||||
fun withContextReceiver(f: context(String) () -> Unit)
|
||||
|
||||
typealias WithSuspend = suspend (String) -> Int
|
||||
|
||||
fun withContextReceiver(f: suspend (String) -> Int)
|
||||
|
||||
typealias WithEverything<T> = suspend context(T, B) String.(Int, T) -> String
|
||||
|
||||
fun withEverything(f: suspend context(A, B) String.(Int, A) -> String)
|
||||
|
||||
Reference in New Issue
Block a user