Flexible types in SAM conversions
This commit is contained in:
@@ -4,7 +4,7 @@ public open class PrivateMembers {
|
|||||||
private constructor PrivateMembers()
|
private constructor PrivateMembers()
|
||||||
private final var field: kotlin.Int
|
private final var field: kotlin.Int
|
||||||
private open fun method(): kotlin.Unit
|
private open fun method(): kotlin.Unit
|
||||||
private final /*synthesized*/ fun samAdapter(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
private final /*synthesized*/ fun samAdapter(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
private open fun samAdapter(/*0*/ p0: test.PrivateMembers.SamInterface!): kotlin.Unit
|
private open fun samAdapter(/*0*/ p0: test.PrivateMembers.SamInterface!): kotlin.Unit
|
||||||
|
|
||||||
private open inner class Inner {
|
private open inner class Inner {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ package test
|
|||||||
|
|
||||||
public open class AmbiguousAdapters {
|
public open class AmbiguousAdapters {
|
||||||
public constructor AmbiguousAdapters()
|
public constructor AmbiguousAdapters()
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public open fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit
|
public open fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit
|
||||||
public open fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
public open fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package test
|
|||||||
|
|
||||||
public open class Basic {
|
public open class Basic {
|
||||||
public constructor Basic()
|
public constructor Basic()
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public open fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
public open fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
|
|
||||||
// Static members
|
// Static members
|
||||||
public /*synthesized*/ fun bar(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public /*synthesized*/ fun bar(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public open fun bar(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
public open fun bar(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public open class Constructor {
|
public open class Constructor {
|
||||||
public /*synthesized*/ constructor Constructor(/*0*/ p0: (() -> kotlin.Unit)?)
|
public /*synthesized*/ constructor Constructor(/*0*/ p0: (() -> kotlin.Unit)!)
|
||||||
public constructor Constructor(/*0*/ p0: java.lang.Runnable!)
|
public constructor Constructor(/*0*/ p0: java.lang.Runnable!)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ package test
|
|||||||
public trait DeepSamLoop {
|
public trait DeepSamLoop {
|
||||||
|
|
||||||
public trait Bar {
|
public trait Bar {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Bar?) -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Bar!) -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: test.DeepSamLoop.Foo!): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: test.DeepSamLoop.Foo!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Foo {
|
public trait Foo {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Foo?) -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Foo!) -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: test.DeepSamLoop.Bar!): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: test.DeepSamLoop.Bar!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static members
|
// Static members
|
||||||
public final /*synthesized*/ fun Bar(/*0*/ function: (test.DeepSamLoop.Foo?) -> kotlin.Unit): test.DeepSamLoop.Bar
|
public /*synthesized*/ fun Bar(/*0*/ function: (test.DeepSamLoop.Foo!) -> kotlin.Unit): test.DeepSamLoop.Bar
|
||||||
public final /*synthesized*/ fun Foo(/*0*/ function: (test.DeepSamLoop.Bar?) -> kotlin.Unit): test.DeepSamLoop.Foo
|
public /*synthesized*/ fun Foo(/*0*/ function: (test.DeepSamLoop.Bar!) -> kotlin.Unit): test.DeepSamLoop.Foo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package test
|
|||||||
|
|
||||||
public open class NonTrivialFunctionType {
|
public open class NonTrivialFunctionType {
|
||||||
public constructor NonTrivialFunctionType()
|
public constructor NonTrivialFunctionType()
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: ((java.io.File, kotlin.String) -> kotlin.Boolean)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: ((java.io.File!, kotlin.String!) -> kotlin.Boolean)!): kotlin.Unit
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: ((kotlin.String, kotlin.String) -> kotlin.Int)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: ((kotlin.String!, kotlin.String!) -> kotlin.Int)!): kotlin.Unit
|
||||||
public open fun foo(/*0*/ p0: java.io.FilenameFilter!): kotlin.Unit
|
public open fun foo(/*0*/ p0: java.io.FilenameFilter!): kotlin.Unit
|
||||||
public open fun foo(/*0*/ p0: java.util.Comparator<kotlin.String!>!): kotlin.Unit
|
public open fun foo(/*0*/ p0: java.util.Comparator<kotlin.String!>!): kotlin.Unit
|
||||||
public final /*synthesized*/ fun wildcardBound(/*0*/ p0: ((kotlin.CharSequence?, kotlin.CharSequence?) -> kotlin.Int)?): kotlin.Unit
|
public final /*synthesized*/ fun wildcardBound(/*0*/ p0: ((kotlin.CharSequence!, kotlin.CharSequence!) -> kotlin.Int)!): kotlin.Unit
|
||||||
public open fun wildcardBound(/*0*/ p0: java.util.Comparator<in kotlin.CharSequence!>!): kotlin.Unit
|
public open fun wildcardBound(/*0*/ p0: java.util.Comparator<in kotlin.CharSequence!>!): kotlin.Unit
|
||||||
public open fun wildcardUnbound(/*0*/ p0: java.util.Comparator<out kotlin.Any?>!): kotlin.Unit
|
public open fun wildcardUnbound(/*0*/ p0: java.util.Comparator<out kotlin.Any?>!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -3,15 +3,15 @@ package test
|
|||||||
public trait AdapterDoesntOverrideDeclaration {
|
public trait AdapterDoesntOverrideDeclaration {
|
||||||
|
|
||||||
public trait Sub : test.AdapterDoesntOverrideDeclaration.Super {
|
public trait Sub : test.AdapterDoesntOverrideDeclaration.Super {
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super {
|
public trait Super {
|
||||||
public abstract fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static members
|
// Static members
|
||||||
public final /*synthesized*/ fun Super(/*0*/ function: ((() -> kotlin.Unit)?) -> kotlin.Unit): test.AdapterDoesntOverrideDeclaration.Super
|
public /*synthesized*/ fun Super(/*0*/ function: ((() -> kotlin.Unit!)!) -> kotlin.Unit): test.AdapterDoesntOverrideDeclaration.Super
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -3,14 +3,14 @@ package test
|
|||||||
public trait InheritedAdapterAndDeclaration {
|
public trait InheritedAdapterAndDeclaration {
|
||||||
|
|
||||||
public trait Sub : test.InheritedAdapterAndDeclaration.Super {
|
public trait Sub : test.InheritedAdapterAndDeclaration.Super {
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit
|
||||||
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super {
|
public trait Super {
|
||||||
public abstract fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-8
@@ -3,16 +3,16 @@ package test
|
|||||||
public trait InheritedAmbiguousAdapters {
|
public trait InheritedAmbiguousAdapters {
|
||||||
|
|
||||||
public trait Sub : test.InheritedAmbiguousAdapters.Super {
|
public trait Sub : test.InheritedAmbiguousAdapters.Super {
|
||||||
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super {
|
public trait Super {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-8
@@ -3,16 +3,16 @@ package test
|
|||||||
public trait InheritedAndOverriddenAmbiguousAdapters {
|
public trait InheritedAndOverriddenAmbiguousAdapters {
|
||||||
|
|
||||||
public trait Sub : test.InheritedAndOverriddenAmbiguousAdapters.Super {
|
public trait Sub : test.InheritedAndOverriddenAmbiguousAdapters.Super {
|
||||||
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit
|
||||||
public abstract override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super {
|
public trait Super {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -4,13 +4,13 @@ public trait InheritedOverridden {
|
|||||||
|
|
||||||
public open class Sub : test.InheritedOverridden.Super {
|
public open class Sub : test.InheritedOverridden.Super {
|
||||||
public constructor Sub()
|
public constructor Sub()
|
||||||
public final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final override /*1*/ /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public open override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public open override /*1*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public open class Super {
|
public open class Super {
|
||||||
public constructor Super()
|
public constructor Super()
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public open fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public open fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -4,13 +4,13 @@ public trait InheritedOverriddenAdapter {
|
|||||||
|
|
||||||
public open class Sub : test.InheritedOverriddenAdapter.Super {
|
public open class Sub : test.InheritedOverriddenAdapter.Super {
|
||||||
public constructor Sub()
|
public constructor Sub()
|
||||||
public open override /*1*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public open override /*1*/ fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit
|
||||||
public open override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public open override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public open class Super {
|
public open class Super {
|
||||||
public constructor Super()
|
public constructor Super()
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public open fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public open fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-9
@@ -3,22 +3,22 @@ package test
|
|||||||
public trait InheritedSameAdapters {
|
public trait InheritedSameAdapters {
|
||||||
|
|
||||||
public trait Sub : test.InheritedSameAdapters.Super1, test.InheritedSameAdapters.Super2 {
|
public trait Sub : test.InheritedSameAdapters.Super1, test.InheritedSameAdapters.Super2 {
|
||||||
public final override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super1 {
|
public trait Super1 {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super2 {
|
public trait Super2 {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static members
|
// Static members
|
||||||
public final /*synthesized*/ fun Sub(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Sub
|
public /*synthesized*/ fun Sub(/*0*/ function: (java.lang.Runnable!) -> kotlin.Unit): test.InheritedSameAdapters.Sub
|
||||||
public final /*synthesized*/ fun Super1(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Super1
|
public /*synthesized*/ fun Super1(/*0*/ function: (java.lang.Runnable!) -> kotlin.Unit): test.InheritedSameAdapters.Super1
|
||||||
public final /*synthesized*/ fun Super2(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Super2
|
public /*synthesized*/ fun Super2(/*0*/ function: (java.lang.Runnable!) -> kotlin.Unit): test.InheritedSameAdapters.Super2
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -3,12 +3,12 @@ package test
|
|||||||
public trait InheritedSimple {
|
public trait InheritedSimple {
|
||||||
|
|
||||||
public trait Sub : test.InheritedSimple.Super {
|
public trait Sub : test.InheritedSimple.Super {
|
||||||
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super {
|
public trait Super {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -3,15 +3,15 @@ package test
|
|||||||
public trait OverriddenAmbiguousAdapters {
|
public trait OverriddenAmbiguousAdapters {
|
||||||
|
|
||||||
public trait Sub : test.OverriddenAmbiguousAdapters.Super {
|
public trait Sub : test.OverriddenAmbiguousAdapters.Super {
|
||||||
public abstract override /*2*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public abstract override /*2*/ fun foo(/*0*/ p0: (() -> kotlin.Unit!)!): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super {
|
public trait Super {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.io.Closeable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.io.Closeable!): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable!): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-5
@@ -22,6 +22,7 @@ import org.jetbrains.jet.lang.descriptors.*;
|
|||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.ValueParameterDescriptorImpl;
|
||||||
|
import org.jetbrains.jet.lang.resolve.java.JavaPackage;
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.*;
|
import org.jetbrains.jet.lang.resolve.java.descriptor.*;
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils;
|
import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.*;
|
import org.jetbrains.jet.lang.resolve.java.structure.*;
|
||||||
@@ -82,7 +83,7 @@ public class SingleAbstractMethodUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private static JetType getFunctionTypeForSamType(@NotNull JetType samType) {
|
private static JetType getFunctionTypeForSamType(@NotNull JetType samType, boolean isSamConstructor) {
|
||||||
// e.g. samType == Comparator<String>?
|
// e.g. samType == Comparator<String>?
|
||||||
|
|
||||||
ClassifierDescriptor classifier = samType.getConstructor().getDeclarationDescriptor();
|
ClassifierDescriptor classifier = samType.getConstructor().getDeclarationDescriptor();
|
||||||
@@ -94,7 +95,16 @@ public class SingleAbstractMethodUtils {
|
|||||||
// Function2<String, String, Int>?
|
// Function2<String, String, Int>?
|
||||||
JetType substitute = TypeSubstitutor.create(samType).substitute(functionTypeDefault, Variance.INVARIANT);
|
JetType substitute = TypeSubstitutor.create(samType).substitute(functionTypeDefault, Variance.INVARIANT);
|
||||||
|
|
||||||
return substitute == null ? null : fixProjections(TypeUtils.makeNullableAsSpecified(substitute, samType.isNullable()));
|
if (substitute == null) return null;
|
||||||
|
|
||||||
|
JetType fixedProjections = fixProjections(substitute);
|
||||||
|
if (fixedProjections == null) return null;
|
||||||
|
|
||||||
|
if (JavaPackage.getPLATFORM_TYPES() && !isSamConstructor) {
|
||||||
|
return new DelegatingFlexibleType(fixedProjections, TypeUtils.makeNullable(fixedProjections));
|
||||||
|
}
|
||||||
|
|
||||||
|
return TypeUtils.makeNullableAsSpecified(fixedProjections, !isSamConstructor && samType.isNullable());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -139,7 +149,7 @@ public class SingleAbstractMethodUtils {
|
|||||||
|
|
||||||
TypeParameters typeParameters = recreateAndInitializeTypeParameters(samInterface.getTypeConstructor().getParameters(), result);
|
TypeParameters typeParameters = recreateAndInitializeTypeParameters(samInterface.getTypeConstructor().getParameters(), result);
|
||||||
|
|
||||||
JetType parameterTypeUnsubstituted = getFunctionTypeForSamType(samInterface.getDefaultType());
|
JetType parameterTypeUnsubstituted = getFunctionTypeForSamType(samInterface.getDefaultType(), true);
|
||||||
assert parameterTypeUnsubstituted != null : "couldn't get function type for SAM type " + samInterface.getDefaultType();
|
assert parameterTypeUnsubstituted != null : "couldn't get function type for SAM type " + samInterface.getDefaultType();
|
||||||
JetType parameterType = typeParameters.substitutor.substitute(parameterTypeUnsubstituted, Variance.IN_VARIANCE);
|
JetType parameterType = typeParameters.substitutor.substitute(parameterTypeUnsubstituted, Variance.IN_VARIANCE);
|
||||||
assert parameterType != null : "couldn't substitute type: " + parameterTypeUnsubstituted +
|
assert parameterType != null : "couldn't substitute type: " + parameterTypeUnsubstituted +
|
||||||
@@ -165,7 +175,7 @@ public class SingleAbstractMethodUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSamType(@NotNull JetType type) {
|
public static boolean isSamType(@NotNull JetType type) {
|
||||||
return getFunctionTypeForSamType(type) != null;
|
return getFunctionTypeForSamType(type, /* irrelevant */ false) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSamAdapterNecessary(@NotNull FunctionDescriptor fun) {
|
public static boolean isSamAdapterNecessary(@NotNull FunctionDescriptor fun) {
|
||||||
@@ -238,7 +248,7 @@ public class SingleAbstractMethodUtils {
|
|||||||
List<ValueParameterDescriptor> valueParameters = new ArrayList<ValueParameterDescriptor>(originalValueParameters.size());
|
List<ValueParameterDescriptor> valueParameters = new ArrayList<ValueParameterDescriptor>(originalValueParameters.size());
|
||||||
for (ValueParameterDescriptor originalParam : originalValueParameters) {
|
for (ValueParameterDescriptor originalParam : originalValueParameters) {
|
||||||
JetType originalType = originalParam.getType();
|
JetType originalType = originalParam.getType();
|
||||||
JetType functionType = getFunctionTypeForSamType(originalType);
|
JetType functionType = getFunctionTypeForSamType(originalType, false);
|
||||||
JetType newTypeUnsubstituted = functionType != null ? functionType : originalType;
|
JetType newTypeUnsubstituted = functionType != null ? functionType : originalType;
|
||||||
JetType newType = typeParameters.substitutor.substitute(newTypeUnsubstituted, Variance.IN_VARIANCE);
|
JetType newType = typeParameters.substitutor.substitute(newTypeUnsubstituted, Variance.IN_VARIANCE);
|
||||||
assert newType != null : "couldn't substitute type: " + newTypeUnsubstituted + ", substitutor = " + typeParameters.substitutor;
|
assert newType != null : "couldn't substitute type: " + newTypeUnsubstituted + ", substitutor = " + typeParameters.substitutor;
|
||||||
|
|||||||
@@ -292,15 +292,6 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String renderType(@NotNull JetType type) {
|
public String renderType(@NotNull JetType type) {
|
||||||
if (type == CANT_INFER_LAMBDA_PARAM_TYPE || type == DONT_CARE) {
|
|
||||||
return "???";
|
|
||||||
}
|
|
||||||
if (ErrorUtils.isUninferredParameter(type)) {
|
|
||||||
if (uninferredTypeParameterAsName) {
|
|
||||||
return renderError(((UninferredParameterTypeConstructor) type.getConstructor()).getTypeParameterDescriptor().getName().toString());
|
|
||||||
}
|
|
||||||
return "???";
|
|
||||||
}
|
|
||||||
if (type instanceof FlexibleType) {
|
if (type instanceof FlexibleType) {
|
||||||
FlexibleType flexibleType = (FlexibleType) type;
|
FlexibleType flexibleType = (FlexibleType) type;
|
||||||
if (!debugMode) {
|
if (!debugMode) {
|
||||||
@@ -310,6 +301,21 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
return "(" + renderType(flexibleType.getLowerBound()) + ".." + renderType(flexibleType.getUpperBound()) + ")";
|
return "(" + renderType(flexibleType.getLowerBound()) + ".." + renderType(flexibleType.getUpperBound()) + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return renderInflexibleType(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String renderInflexibleType(@NotNull JetType type) {
|
||||||
|
assert !TypesPackage.isFlexible(type) : "Flexible types not allowed here: " + renderType(type);
|
||||||
|
|
||||||
|
if (type == CANT_INFER_LAMBDA_PARAM_TYPE || type == DONT_CARE) {
|
||||||
|
return "???";
|
||||||
|
}
|
||||||
|
if (ErrorUtils.isUninferredParameter(type)) {
|
||||||
|
if (uninferredTypeParameterAsName) {
|
||||||
|
return renderError(((UninferredParameterTypeConstructor) type.getConstructor()).getTypeParameterDescriptor().getName().toString());
|
||||||
|
}
|
||||||
|
return "???";
|
||||||
|
}
|
||||||
if (type instanceof LazyType && debugMode) {
|
if (type instanceof LazyType && debugMode) {
|
||||||
return type.toString();
|
return type.toString();
|
||||||
}
|
}
|
||||||
@@ -327,10 +333,14 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
JetType lower = type.getLowerBound();
|
JetType lower = type.getLowerBound();
|
||||||
JetType upper = type.getUpperBound();
|
JetType upper = type.getUpperBound();
|
||||||
|
|
||||||
String lowerRendered = renderDefaultType(lower);
|
String lowerRendered = renderInflexibleType(lower);
|
||||||
String upperRendered = renderDefaultType(upper);
|
String upperRendered = renderInflexibleType(upper);
|
||||||
|
|
||||||
if (differsOnlyInNullability(lowerRendered, upperRendered)) {
|
if (differsOnlyInNullability(lowerRendered, upperRendered)) {
|
||||||
|
if (upperRendered.startsWith("(")) {
|
||||||
|
// the case of complex type, e.g. (() -> Unit)?
|
||||||
|
return "(" + lowerRendered + ")!";
|
||||||
|
}
|
||||||
return lowerRendered + "!";
|
return lowerRendered + "!";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,7 +368,8 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean differsOnlyInNullability(String lower, String upper) {
|
private static boolean differsOnlyInNullability(String lower, String upper) {
|
||||||
return lower.equals(upper.replace("?", "")) || upper.endsWith("?") && (lower + "?").equals(upper);
|
return lower.equals(upper.replace("?", ""))
|
||||||
|
|| upper.endsWith("?") && ((lower + "?").equals(upper)) || (("(" + lower + ")?").equals(upper));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
Reference in New Issue
Block a user