From 3b56b90a7c8cd0e1a4a8ba5a8513df422f86949b Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Sat, 18 Feb 2012 00:33:26 +0400 Subject: [PATCH] split ConflictingOverloads.jet test, add property overload conflict test --- .../tests/ConflictingOverloads.jet | 95 ------------------- ...ingOverloadsFunsDifferentReturnInClass.jet | 6 ++ ...gOverloadsFunsDifferentReturnInPackage.jet | 7 ++ ...tingOverloadsIdenticalExtFunsInPackage.jet | 5 + ...nflictingOverloadsIdenticalFunsInClass.jet | 7 ++ ...nflictingOverloadsIdenticalValsInClass.jet | 4 + ...ctingOverloadsValsDifferentTypeInClass.jet | 4 + .../overload/ConstructorVsFunOverload.jet | 30 ++++++ .../overload/ExtFunDifferentReceiver.jet | 3 + .../FunNoConflictInDifferentPackages.jet | 13 +++ .../overload/OverloadFunRegularAndExt.jet | 7 ++ .../overload/OverloadVarAndFunInClass.jet | 4 + 12 files changed, 90 insertions(+), 95 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/ConflictingOverloads.jet create mode 100644 compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInClass.jet create mode 100644 compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInPackage.jet create mode 100644 compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalExtFunsInPackage.jet create mode 100644 compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalFunsInClass.jet create mode 100644 compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalValsInClass.jet create mode 100644 compiler/testData/diagnostics/tests/overload/ConflictingOverloadsValsDifferentTypeInClass.jet create mode 100644 compiler/testData/diagnostics/tests/overload/ConstructorVsFunOverload.jet create mode 100644 compiler/testData/diagnostics/tests/overload/ExtFunDifferentReceiver.jet create mode 100644 compiler/testData/diagnostics/tests/overload/FunNoConflictInDifferentPackages.jet create mode 100644 compiler/testData/diagnostics/tests/overload/OverloadFunRegularAndExt.jet create mode 100644 compiler/testData/diagnostics/tests/overload/OverloadVarAndFunInClass.jet diff --git a/compiler/testData/diagnostics/tests/ConflictingOverloads.jet b/compiler/testData/diagnostics/tests/ConflictingOverloads.jet deleted file mode 100644 index 32db4f06e3c..00000000000 --- a/compiler/testData/diagnostics/tests/ConflictingOverloads.jet +++ /dev/null @@ -1,95 +0,0 @@ -// FILE: b.kt -// http://youtrack.jetbrains.net/issue/KT-424 - -class A { - fun a(a: Int): Int = 0 - - fun a(a: Int) { - } - - fun b() { - } - - fun b() { - } -} - -// FILE: b.kt -package deepSpace - fun c(s: String) { - } - - fun c(s: String) { - } - - class B { - fun d(s: String) { - } - - fun d(s: String) { - } - } - -// FILE: b.kt -// check no error in overload in different namespaces - -package ns1 - fun e() = 1 - -// FILE: b.kt -package ns2 - fun e() = 1 - -// FILE: b.kt -package ns3.ns1 - fun e() = 1 - -// FILE: b.kt -// check same rules apply for ext functions - -package extensionFunctions - fun Int.qwe(a: Float) = 1 - - fun Int.qwe(a: Float) = 2 - - fun Int.rty() = 3 - - fun String.rty() = 4 - -// FILE: b.kt -// check no error when regular function and extension function have same name - -package extensionAndRegular - fun who() = 1 - - fun Int.who() = 1 - -// FILE: b.kt -// constructor vs. fun overload - -package constructorVsFun - class a() { } - - fun a() = 1 - - class Tram { - fun f() { } - - class f() { } - } - - class Yvayva { - class object { - fun fghj() { } - - class fghj() { } - } - } - - class Rtyu { - fun ololo() { } - - class object { - class ololo() { } - } - } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInClass.jet b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInClass.jet new file mode 100644 index 00000000000..184876677c1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInClass.jet @@ -0,0 +1,6 @@ +class A { + fun a(a: Int): Int = 0 + + fun a(a: Int) { + } +} diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInPackage.jet b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInPackage.jet new file mode 100644 index 00000000000..0ee31c687f7 --- /dev/null +++ b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsFunsDifferentReturnInPackage.jet @@ -0,0 +1,7 @@ +package qwertyuiop + +fun c(s: String) { +} + +fun c(s: String) { +} diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalExtFunsInPackage.jet b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalExtFunsInPackage.jet new file mode 100644 index 00000000000..9a29d4b564b --- /dev/null +++ b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalExtFunsInPackage.jet @@ -0,0 +1,5 @@ +package extensionFunctions + +fun Int.qwe(a: Float) = 1 + +fun Int.qwe(a: Float) = 2 diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalFunsInClass.jet b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalFunsInClass.jet new file mode 100644 index 00000000000..a0f0a29a765 --- /dev/null +++ b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalFunsInClass.jet @@ -0,0 +1,7 @@ +class A() { + fun b() { + } + + fun b() { + } +} diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalValsInClass.jet b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalValsInClass.jet new file mode 100644 index 00000000000..1a90a9df0c5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsIdenticalValsInClass.jet @@ -0,0 +1,4 @@ +class Aaa() { + val a = 1 + val a = 1 +} diff --git a/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsValsDifferentTypeInClass.jet b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsValsDifferentTypeInClass.jet new file mode 100644 index 00000000000..f813fd25a32 --- /dev/null +++ b/compiler/testData/diagnostics/tests/overload/ConflictingOverloadsValsDifferentTypeInClass.jet @@ -0,0 +1,4 @@ +class Aaa() { + val a = 1 + val a = "" +} diff --git a/compiler/testData/diagnostics/tests/overload/ConstructorVsFunOverload.jet b/compiler/testData/diagnostics/tests/overload/ConstructorVsFunOverload.jet new file mode 100644 index 00000000000..10d22edc36b --- /dev/null +++ b/compiler/testData/diagnostics/tests/overload/ConstructorVsFunOverload.jet @@ -0,0 +1,30 @@ +// constructor vs. fun overload + +package constructorVsFun + +class a() { } + +fun a() = 1 + +class Tram { + fun f() { } + + class f() { } +} + +class Yvayva { + class object { + fun fghj() { } + + class fghj() { } + } +} + +class Rtyu { + fun ololo() { } + + class object { + class ololo() { } + } +} + diff --git a/compiler/testData/diagnostics/tests/overload/ExtFunDifferentReceiver.jet b/compiler/testData/diagnostics/tests/overload/ExtFunDifferentReceiver.jet new file mode 100644 index 00000000000..066ad1f50a0 --- /dev/null +++ b/compiler/testData/diagnostics/tests/overload/ExtFunDifferentReceiver.jet @@ -0,0 +1,3 @@ +fun Int.rty() = 3 + +fun String.rty() = 4 diff --git a/compiler/testData/diagnostics/tests/overload/FunNoConflictInDifferentPackages.jet b/compiler/testData/diagnostics/tests/overload/FunNoConflictInDifferentPackages.jet new file mode 100644 index 00000000000..1fc95b838f0 --- /dev/null +++ b/compiler/testData/diagnostics/tests/overload/FunNoConflictInDifferentPackages.jet @@ -0,0 +1,13 @@ +// FILE: ns1.kt +// check no error in overload in different namespaces + +package ns1 +fun e() = 1 + +// FILE: ns2.kt +package ns2 +fun e() = 1 + +// FILE: ns3ns1.kt +package ns3.ns1 +fun e() = 1 diff --git a/compiler/testData/diagnostics/tests/overload/OverloadFunRegularAndExt.jet b/compiler/testData/diagnostics/tests/overload/OverloadFunRegularAndExt.jet new file mode 100644 index 00000000000..34c84965174 --- /dev/null +++ b/compiler/testData/diagnostics/tests/overload/OverloadFunRegularAndExt.jet @@ -0,0 +1,7 @@ +// check no error when regular function and extension function have same name + +package extensionAndRegular + +fun who() = 1 + +fun Int.who() = 1 diff --git a/compiler/testData/diagnostics/tests/overload/OverloadVarAndFunInClass.jet b/compiler/testData/diagnostics/tests/overload/OverloadVarAndFunInClass.jet new file mode 100644 index 00000000000..201a1193c06 --- /dev/null +++ b/compiler/testData/diagnostics/tests/overload/OverloadVarAndFunInClass.jet @@ -0,0 +1,4 @@ +class Aaaa() { + val bb = 1 + fun bb() = 1 +}