Alphabetical sort wrapped intersection types for rendered diagnostics

This commit is contained in:
victor.petukhov
2018-12-28 15:34:42 +03:00
parent acd6d354dc
commit ec8a6cbe9c
118 changed files with 1387 additions and 937 deletions
@@ -1,29 +0,0 @@
fun getInt(arg: Any = Any()) = arg.hashCode()
fun getShort(arg: Any = Any()) = arg.hashCode().toShort()
fun getLong(arg: Any = Any()) = arg.hashCode().toLong()
fun getFloat(arg: Any = Any()) = arg.hashCode().toFloat()
fun getDouble(arg: Any = Any()) = arg.hashCode().toDouble()
fun getByte(arg: Any = Any()) = arg.hashCode().toByte()
fun getChar(arg: Any = Any()) = arg.hashCode().toChar()
fun getString(arg: Any = Any()) = arg.hashCode().toString()
fun getBoolean(arg: Any = Any()) = arg.hashCode() % 2 == 0
fun getNothing(): Nothing = throw Exception()
fun getUnit() = {}
fun getAny() = Any()
fun getList() = mutableListOf<Int>()
class _BasicTypesProvider {
fun getInt(arg: Any = Any()) = arg.hashCode()
fun getShort(arg: Any = Any()) = arg.hashCode().toShort()
fun getLong(arg: Any = Any()) = arg.hashCode().toLong()
fun getFloat(arg: Any = Any()) = arg.hashCode().toFloat()
fun getDouble(arg: Any = Any()) = arg.hashCode().toDouble()
fun getByte(arg: Any = Any()) = arg.hashCode().toByte()
fun getChar(arg: Any = Any()) = arg.hashCode().toChar()
fun getString(arg: Any = Any()) = arg.hashCode().toString()
fun getBoolean(arg: Any = Any()) = arg.hashCode() % 2 == 0
fun getNothing(): Nothing = throw Exception()
fun getUnit() = {}
fun getAny() = Any()
fun getList() = mutableListOf<Int>()
}
+60 -15
View File
@@ -1,19 +1,23 @@
class _Class {
class Class {
val prop_1 = 1
val prop_2 = 2
val prop_3 = 3
val prop_4: Float? = 3f
val prop_5: Float = 3f
val prop_6: String = "..."
val prop_7: Nothing? = "..."
fun fun_1(): (Int) -> (Int) -> Int = {number: Int -> { number * 5 }}
fun fun_2(value_1: Int): Int = value_1 * 2
fun fun_3(value_1: Int): (Int) -> Int = fun(value_2: Int): Int = value_1 * value_2 * 2
operator fun contains(a: Int): Boolean = a > 30
operator fun contains(a: Long): Boolean = a > 30L
operator fun contains(a: Char): Boolean = a > 30.toChar()
operator fun contains(a: Int) = a > 30
operator fun contains(a: Long) = a > 30L
operator fun contains(a: Char) = a > 30.toChar()
fun getIntArray(value_1: Int): IntArray = intArrayOf(1, 2, 3, value_1, 91923, 14, 123124)
fun getLongArray(value_1: Long): LongArray = longArrayOf(1L, 2L, 3L, value_1, 9192323244L, 14L, 123124L)
fun getCharArray(value_1: Char): CharArray = charArrayOf(1.toChar(), 2.toChar(), 3.toChar(), value_1)
fun getIntArray() = intArrayOf(1, 2, 3, 4, 5)
fun getLongArray() = longArrayOf(1L, 2L, 3L, 4L, 5L)
fun getCharArray() = charArrayOf(1.toChar(), 2.toChar(), 3.toChar(), 4.toChar(), 5.toChar())
class _NestedClass {
val prop_4 = 4
@@ -21,15 +25,56 @@ class _Class {
}
}
class _EmptyClass {}
class EmptyClass {}
class _ClassWithCompanionObject {
class ClassWithCompanionObject {
companion object {}
}
open class _ClassLevel1 {}
open class _ClassLevel2: _ClassLevel1() {}
open class _ClassLevel3: _ClassLevel2() {}
open class _ClassLevel4: _ClassLevel3() {}
open class _ClassLevel5: _ClassLevel4() {}
class _ClassLevel6: _ClassLevel5() {}
open class ClassLevel1 {
fun test1() {}
}
open class ClassLevel2: ClassLevel1() {
fun test2() {}
}
open class ClassLevel3: ClassLevel2() {
fun test3() {}
}
open class ClassLevel4: ClassLevel3() {
fun test4() {}
}
open class ClassLevel5: ClassLevel4() {
fun test5() {}
}
class ClassLevel6: ClassLevel5() {
fun test6() {}
}
class Inv<T>(val x: T = null as T) {
fun test() {}
fun get() = x
fun put(x: T) {}
fun getNullable(): T? = select(x, null)
}
class In<in T>() {
fun put(x: T) {}
fun <K : T> getWithUpperBoundT(): K = x <!UNCHECKED_CAST!>as K<!>
}
class Out<out T>(val x: T = null as T) {
fun get() = x
}
open class ClassWithTwoTypeParameters<K, L> {
fun test1(): T? { return null }
fun test2(): K? { return null }
}
class ClassWithThreeTypeParameters<K, L, M>(
val x: K,
val y: L,
val z: M
)
class ClassWithSixTypeParameters<K, in L, out M, O, in P, out R>
@@ -1,9 +1,21 @@
enum class _EnumClass {
enum class EnumClass {
NORTH, SOUTH, WEST, EAST
}
enum class _EnumClassSingle {
enum class EnumClassSingle {
EVERYTHING
}
enum class _EnumClassEmpty
enum class EnumClassEmpty
enum class EnumClassWithNullableProperty(val prop_1: Int?) {
A(1),
B(5),
D(null)
}
enum class EnumClassWithProperty(val prop_1: Int) {
A(1),
B(5),
D(6)
}
@@ -1,7 +1,19 @@
fun _funWithoutArgs(): Int {
fun funWithoutArgs(): Int {
return Any().hashCode().toInt()
}
fun _funWithAnyArg(value_1: Any): Int {
fun funWithAnyArg(value_1: Any): Int {
return value_1.hashCode()
}
fun <K> select(vararg x: K): K = x[0]
fun <K> expandInv(vararg x: Inv<K>): K = x[0] as K
fun <K> expandIn(vararg x: In<K>): K = x[0] as K
fun <K> expandOut(vararg x: Out<K>): K = x[0] as K
fun <K> expandInvWithRemoveNullable(vararg x: Inv<K?>): K = x[0] as K
fun <K> expandInWithRemoveNullable(vararg x: In<K?>): K = x[0] as K
fun <K> expandOutWithRemoveNullable(vararg x: Out<K?>): K = x[0] as K
fun <K> removeNullable(vararg x: K?): K = x as K
@@ -0,0 +1,49 @@
interface EmptyInterface
interface Interface1 {
fun itest() {}
fun itest1() {}
}
interface Interface2 {
fun itest() {}
fun itest2() {}
}
interface Interface3 {
fun itest() {}
fun itest3() {}
}
interface InterfaceWithOutParameter<out T>
interface InterfaceWithTypeParameter1<T> {
fun ip1test1(): T? = null as T?
}
interface InterfaceWithTypeParameter2<T> {
fun ip1test2(): T? = null as T?
}
interface InterfaceWithTypeParameter3<T> {
fun ip1test3(): T? = null as T?
}
interface InterfaceWithFiveTypeParameters1<T1, T2, T3, T4, T5> {
fun itest() {}
fun itest1() {}
}
interface InterfaceWithFiveTypeParameters2<T1, T2, T3, T4, T5> {
fun itest() {}
fun itest2() {}
}
interface InterfaceWithFiveTypeParameters3<T1, T2, T3, T4, T5> {
fun itest() {}
fun itest3() {}
}
interface InterfaceWithTwoTypeParameters<T, K> {
fun ip2test(): T? = null as T?
}
+28 -1
View File
@@ -1 +1,28 @@
object _EmptyObject {}
object EmptyObject {}
object Object {
val prop_1: Number? = 1
val prop_2: Number = 1
}
object DeepObject {
val prop_1 = null
var prop_2 = null
object A {
object B {
object C {
object D {
object E {
object F {
object G {
object J {
val x: Int? = 10
}
}
}
}
}
}
}
}
}
@@ -0,0 +1,16 @@
val nullableNumberProperty: Number? = null
val stringProperty: String = ""
val nullableStringProperty: String? = null
val intProperty: Int = ""
val nullableIntProperty: Int? = null
val implicitNullableNothingProperty = null
val nullableNothingProperty: Nothing? = null
val anonymousTypeProperty = object {}
val nullableAnonymousTypeProperty = if (true) object {} else null
val nullableOut: Out<Int>? = null
@@ -1,36 +1,36 @@
sealed class _SealedClass
data class _SealedChild1(val number: Int) : _SealedClass()
data class _SealedChild2(val e1: Int, val e2: Int) : _SealedClass()
data class _SealedChild3(val m1: Int, val m2: Int) : _SealedClass()
sealed class SealedClass
data class SealedChild1(val number: Int) : SealedClass()
data class SealedChild2(val e1: Int, val e2: Int) : SealedClass()
data class SealedChild3(val m1: Int, val m2: Int) : SealedClass()
sealed class _SealedClassWithObjects
object _SealedWithObjectsChild1 : _SealedClassWithObjects()
object _SealedWithObjectsChild2 : _SealedClassWithObjects()
object _SealedWithObjectsChild3 : _SealedClassWithObjects()
sealed class SealedClassWithObjects
object SealedWithObjectsChild1 : SealedClassWithObjects()
object SealedWithObjectsChild2 : SealedClassWithObjects()
object SealedWithObjectsChild3 : SealedClassWithObjects()
sealed class _SealedClassSingle
data class _SealedSingleChild1(val number: Int) : _SealedClassSingle()
sealed class SealedClassSingle
data class SealedSingleChild1(val number: Int) : SealedClassSingle()
sealed class _SealedClassSingleWithObject
object _SealedSingleWithObjectChild1: Expr3() {}
sealed class SealedClassSingleWithObject
object SealedSingleWithObjectChild1: Expr3() {}
sealed class _SealedClassEmpty
sealed class SealedClassEmpty
sealed class _SealedClassWithMethods
class _SealedWithMethodsChild1() : _SealedClassWithMethods() {
sealed class SealedClassWithMethods
class SealedWithMethodsChild1() : SealedClassWithMethods() {
fun m1() = this.hashCode().toString()
}
class _SealedWithMethodsChild2() : _SealedClassWithMethods() {
class SealedWithMethodsChild2() : SealedClassWithMethods() {
fun m2() = this.hashCode().toString()
}
class _SealedWithMethodsChild3() : _SealedClassWithMethods() {
class SealedWithMethodsChild3() : SealedClassWithMethods() {
fun m3() = this.hashCode().toString()
}
sealed class _SealedClassMixed
data class _SealedMixedChild1(val number: Int) : _SealedClassMixed()
data class _SealedMixedChild2(val e1: Int, val e2: Int) : _SealedClassMixed()
data class _SealedMixedChild3(val m1: Int, val m2: Int) : _SealedClassMixed()
object _SealedMixedChildObject1 : _SealedClassMixed()
object _SealedMixedChildObject2 : _SealedClassMixed()
object _SealedMixedChildObject3 : _SealedClassMixed()
sealed class SealedClassMixed
data class SealedMixedChild1(val number: Int) : SealedClassMixed()
data class SealedMixedChild2(val e1: Int, val e2: Int) : SealedClassMixed()
data class SealedMixedChild3(val m1: Int, val m2: Int) : SealedClassMixed()
object SealedMixedChildObject1 : SealedClassMixed()
object SealedMixedChildObject2 : SealedClassMixed()
object SealedMixedChildObject3 : SealedClassMixed()
@@ -1,4 +1,9 @@
typealias _TypeAliasAny = Any
typealias _TypeAliasUnit = Unit
typealias _TypeAliasNothing = Nothing
typealias _TypeAliasInt = Int
typealias TypealiasAny = Any
typealias TypealiasUnit = Unit
typealias TypealiasNothing = Nothing
typealias TypealiasNullableNothing = Nothing?
typealias TypealiasInt = Int
typealias TypealiasFloat = Float
typealias TypealiasString = String
typealias TypealiasNullableString = String?
typealias TypealiasNullableStringIndirect = TypealiasNullableString
@@ -0,0 +1,29 @@
fun getInt() = Any().hashCode()
fun getShort() = Any().hashCode().toShort()
fun getLong() = Any().hashCode().toLong()
fun getFloat() = Any().hashCode().toFloat()
fun getDouble() = Any().hashCode().toDouble()
fun getByte() = Any().hashCode().toByte()
fun getChar() = Any().hashCode().toChar()
fun getString() = Any().hashCode().toString()
fun getBoolean() = Any().hashCode() % 2 == 0
fun getNothing(): Nothing = throw Exception()
fun getUnit() = {}
fun getAny() = Any()
fun getList() = listOf<Int>()
class TypesProvider {
fun getInt() = Any().hashCode()
fun getShort() = Any().hashCode().toShort()
fun getLong() = Any().hashCode().toLong()
fun getFloat() = Any().hashCode().toFloat()
fun getDouble() = Any().hashCode().toDouble()
fun getByte() = Any().hashCode().toByte()
fun getChar() = Any().hashCode().toChar()
fun getString() = Any().hashCode().toString()
fun getBoolean() = Any().hashCode() % 2 == 0
fun getNothing(): Nothing = throw Exception()
fun getUnit() = {}
fun getAny() = Any()
fun getList() = listOf<Int>()
}