j2k: flatten test cases and testData directory structure

Move j2k/test/tests -> j2k/tests, j2k/test/testData -> j2k/testData
This commit is contained in:
Alexander Udalov
2015-01-03 00:49:40 +03:00
parent ed2f123b54
commit 3c859caf2b
1137 changed files with 1417 additions and 1412 deletions
@@ -0,0 +1,22 @@
package pack
class C {
C(int arg1, int arg2, int arg3) {
}
C(int arg1, int arg2) {
this(arg1, arg2, 0);
}
C(int arg1) {
this(arg1, 0, 0);
}
}
public class User {
public static void main() {
C c1 = new C(100, 100, 100);
C c2 = new C(100, 100);
C c3 = new C(100);
}
}
@@ -0,0 +1,13 @@
package pack
class C(arg1: Int, arg2: Int = 0, arg3: Int = 0)
public class User {
class object {
public fun main() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100)
val c3 = C(100)
}
}
}
@@ -0,0 +1,31 @@
class C {
final int myArg1;
int myArg2;
int myArg3;
C(int arg1, int arg2, int arg3) {
this(arg1);
myArg2 = arg2;
myArg3 = arg3;
}
C(int arg1, int arg2) {
this(arg1);
myArg2 = arg2;
myArg3 = 0;
}
C(int arg1) {
myArg1 = arg1;
myArg2 = 0;
myArg3 = 0;
}
}
public class User {
public static void main() {
C c1 = new C(100, 100, 100);
C c2 = new C(100, 100);
C c3 = new C(100);
}
}
@@ -0,0 +1,33 @@
fun C(arg1: Int, arg2: Int, arg3: Int): C {
val __ = C(arg1)
__.myArg2 = arg2
__.myArg3 = arg3
return __
}
fun C(arg1: Int, arg2: Int): C {
val __ = C(arg1)
__.myArg2 = arg2
__.myArg3 = 0
return __
}
class C(val myArg1: Int) {
var myArg2: Int = 0
var myArg3: Int = 0
{
myArg2 = 0
myArg3 = 0
}
}
public class User {
class object {
public fun main() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100)
val c3 = C(100)
}
}
}
@@ -0,0 +1,13 @@
public class Test {
private final String s;
boolean b;
double d;
public Test() {
b = true;
}
public Test(String s) {
this.s = s;
}
}
@@ -0,0 +1,18 @@
// ERROR: 'public fun Test(s: kotlin.String): Test' is already defined in root package
// ERROR: 'public constructor Test(s: kotlin.String)' is already defined in root package
// ERROR: None of the following functions can be called with the arguments supplied: public fun Test(): Test defined in root package public fun Test(s: kotlin.String): Test defined in root package public constructor Test(s: kotlin.String) defined in Test
// ERROR: Overload resolution ambiguity: public fun Test(s: kotlin.String): Test defined in root package public constructor Test(s: kotlin.String) defined in Test
public fun Test(): Test {
val __ = Test(null)
__.b = true
return __
}
public fun Test(s: String): Test {
return Test(s)
}
public class Test(private val s: String) {
var b: Boolean = false
var d: Double = 0.toDouble()
}
@@ -0,0 +1,22 @@
class C {
C(int arg1, int arg2, int arg3) {
}
C(int arg1, int arg2) {
this(arg1, arg2, 0);
System.out.println();
}
C(int arg1) {
this(arg1, 0);
System.out.println();
}
}
public class User {
public static void main() {
C c1 = new C(1, 2, 3);
C c2 = new C(5, 6);
C c3 = new C(7);
}
}
@@ -0,0 +1,23 @@
fun C(arg1: Int, arg2: Int): C {
val __ = C(arg1, arg2, 0)
System.out.println()
return __
}
fun C(arg1: Int): C {
val __ = C(arg1, 0)
System.out.println()
return __
}
class C(arg1: Int, arg2: Int, arg3: Int)
public class User {
class object {
public fun main() {
val c1 = C(1, 2, 3)
val c2 = C(5, 6)
val c3 = C(7)
}
}
}
@@ -0,0 +1,29 @@
import javaApi.Anon5;
class A {
private final int a;
private final int b;
@Anon5(10)
public A(int a, int b) {
this.a = a;
this.b = b;
}
@Deprecated // this constructor will not be replaced by default parameter value in primary because of this annotation
public A(int a) {
this(a, 1);
}
}
class B {
@Anon5(11)
public B() {
}
}
class C {
@Anon5(12)
private C() {
}
}
@@ -0,0 +1,17 @@
import javaApi.Anon5
deprecated("") // this constructor will not be replaced by default parameter value in primary because of this annotation
fun A(a: Int): A {
return A(a, 1)
}
class A
[Anon5(10)]
(private val a: Int, private val b: Int)
class B [Anon5(11)]
()
class C [Anon5(12)]
private()
@@ -0,0 +1,54 @@
package org.test.customer
class Customer {
public final String _firstName;
public final String _lastName;
Customer(String first, String last) {
doSmthBefore();
_firstName = first;
_lastName = last;
doSmthAfter();
}
public String getFirstName() {
return _firstName;
}
public String getLastName() {
return _lastName;
}
private void doSmthBefore() {}
private void doSmthAfter() {}
}
class CustomerBuilder {
public String _firstName = "Homer";
public String _lastName = "Simpson";
public CustomerBuilder WithFirstName(String firstName) {
_firstName = firstName;
return this;
}
public CustomerBuilder WithLastName(String lastName) {
_lastName = lastName;
return this;
}
public Customer Build() {
return new Customer(_firstName, _lastName);
}
}
public class User {
public static void main(Array[String] args) {
Customer customer = new CustomerBuilder()
.WithFirstName("Homer")
.WithLastName("Simpson")
.Build();
System.out.println(customer.getFirstName());
System.out.println(customer.getLastName());
}
}
@@ -0,0 +1,44 @@
package org.test.customer
class Customer(public val firstName: String, public val lastName: String) {
{
doSmthBefore()
doSmthAfter()
}
private fun doSmthBefore() {
}
private fun doSmthAfter() {
}
}
class CustomerBuilder {
public var _firstName: String = "Homer"
public var _lastName: String = "Simpson"
public fun WithFirstName(firstName: String): CustomerBuilder {
_firstName = firstName
return this
}
public fun WithLastName(lastName: String): CustomerBuilder {
_lastName = lastName
return this
}
public fun Build(): Customer {
return Customer(_firstName, _lastName)
}
}
public class User {
class object {
public fun main() {
val customer = CustomerBuilder().WithFirstName("Homer").WithLastName("Simpson").Build()
System.out.println(customer.firstName)
System.out.println(customer.lastName)
}
}
}
@@ -0,0 +1,11 @@
class C {
private final int p1;
private final int myP2;
public int p3;
public C(int p1, int p2, int p3) {
this.p1 = p1;
myP2 = p2;
this.p3 = p3;
}
}
@@ -0,0 +1 @@
class C(private val p1: Int, private val myP2: Int, public var p3: Int)
@@ -0,0 +1,8 @@
class C {
private final int field;
public C(int p) {
field = p
System.out.println(p);
}
}
@@ -0,0 +1,6 @@
class C(private val field: Int) {
{
System.out.println(field)
}
}
@@ -0,0 +1,9 @@
class C {
private final int p;
public C(int p) {
this.p = p
System.out.println(p++);
System.out.println(p);
}
}
@@ -0,0 +1,10 @@
class C(p: Int) {
private val p: Int
{
var p = p
this.p = p
System.out.println(p++)
System.out.println(p)
}
}
@@ -0,0 +1,7 @@
class C {
public int p;
public C(int p, C c) {
c.p = p;
}
}
@@ -0,0 +1,7 @@
class C(p: Int, c: C) {
public var p: Int = 0
{
c.p = p
}
}
@@ -0,0 +1,10 @@
class C {
public int p;
public C(int p) {
this.p = 0
if (p > 0) {
this.p = p
}
}
}
@@ -0,0 +1,10 @@
class C(p: Int) {
public var p: Int = 0
{
this.p = 0
if (p > 0) {
this.p = p
}
}
}
@@ -0,0 +1,7 @@
class C {
public Object x;
public C(String x) {
this.x = x;
}
}
@@ -0,0 +1,7 @@
class C(x: String) {
public var x: Any
{
this.x = x
}
}
@@ -0,0 +1,9 @@
class C {
public Object x;
public C(Object x, boolean b) {
if (b) {
this.x = x;
}
}
}
@@ -0,0 +1,10 @@
// ERROR: Property must be initialized or be abstract
class C(x: Any, b: Boolean) {
public var x: Any
{
if (b) {
this.x = x
}
}
}
@@ -0,0 +1,12 @@
class Base {
Base(Object o, int l){}
}
class C extends Base {
private final String string;
public C(String s) {
super(s, s.length());
this.string = s;
}
}
@@ -0,0 +1,3 @@
open class Base(o: Any, l: Int)
class C(private val string: String) : Base(string, string.length())
@@ -0,0 +1,11 @@
class C {
private final String string;
public C(String s, int a) {
this.string = s;
}
public C(String s) {
this(s, s.length());
}
}
@@ -0,0 +1 @@
class C(private val string: String, a: Int = string.length())
@@ -0,0 +1,14 @@
import java.lang.Deprecated;
import java.lang.SuppressWarnings;
class C {
@Deprecated private final int p1;
private final int myP2;
@SuppressWarnings("x") public int p3;
public C(int p1, @Deprecated int p2, @Deprecated int p3) {
this.p1 = p1;
myP2 = p2;
this.p3 = p3;
}
}
@@ -0,0 +1,3 @@
import java.lang.SuppressWarnings
class C(deprecated("") private val p1: Int, deprecated("") private val myP2: Int, deprecated("") SuppressWarnings("x") public var p3: Int)
@@ -0,0 +1,33 @@
public class Identifier<T> {
private final T myName;
private boolean myHasDollar;
private boolean myNullable = true;
public Identifier(T name) {
myName = name;
}
public Identifier(T name, boolean isNullable) {
myName = name;
myNullable = isNullable;
}
public Identifier(T name, boolean hasDollar, boolean isNullable) {
myName = name;
myHasDollar = hasDollar;
myNullable = isNullable;
}
@Override
public T getName() {
return myName;
}
}
public class User {
public static void main() {
Identifier<?> i1 = new Identifier<String>("name", false, true);
Identifier i2 = new Identifier<String>("name", false);
Identifier i3 = new Identifier<String>("name");
}
}
@@ -0,0 +1,35 @@
// ERROR: 'public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T>' is already defined in root package
// ERROR: 'public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean)' is already defined in root package
// ERROR: Cannot choose among the following candidates without completing type inference: public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T> defined in root package public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean) defined in Identifier
// ERROR: Cannot choose among the following candidates without completing type inference: public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T> defined in root package public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean) defined in Identifier
// ERROR: Cannot choose among the following candidates without completing type inference: public fun <T> Identifier(name: T, isNullable: kotlin.Boolean): Identifier<T> defined in root package public constructor Identifier<T>(name: T, myHasDollar: kotlin.Boolean) defined in Identifier
// ERROR: Overload resolution ambiguity: public fun <T> Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier<kotlin.String> defined in root package public constructor Identifier<T>(name: kotlin.String, myHasDollar: kotlin.Boolean) defined in Identifier
public fun <T> Identifier(name: T): Identifier<T> {
return Identifier(name, false)
}
public fun <T> Identifier(name: T, isNullable: Boolean): Identifier<T> {
val __ = Identifier(name, false)
__.myNullable = isNullable
return __
}
public fun <T> Identifier(name: T, hasDollar: Boolean, isNullable: Boolean): Identifier<T> {
val __ = Identifier(name, hasDollar)
__.myNullable = isNullable
return __
}
public class Identifier<T>(public val name: T, private val myHasDollar: Boolean) {
private var myNullable = true
}
public class User {
class object {
public fun main() {
val i1 = Identifier("name", false, true)
val i2 = Identifier<String>("name", false)
val i3 = Identifier("name")
}
}
}
@@ -0,0 +1,33 @@
public class Identifier {
private final String myName;
private boolean myHasDollar;
private boolean myNullable = true;
public Identifier(String name) {
myName = name;
}
public Identifier(String name, boolean isNullable) {
myName = name;
myNullable = isNullable;
}
public Identifier(String name, boolean hasDollar, boolean isNullable) {
myName = name;
myHasDollar = hasDollar;
myNullable = isNullable;
}
@Override
public String getName() {
return myName;
}
}
public class User {
public static void main() {
Identifier i1 = new Identifier("name", false, true);
Identifier i2 = new Identifier("name", false);
Identifier i3 = new Identifier("name");
}
}
@@ -0,0 +1,35 @@
// ERROR: 'public fun Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier' is already defined in root package
// ERROR: 'public constructor Identifier(name: kotlin.String, myHasDollar: kotlin.Boolean)' is already defined in root package
// ERROR: Overload resolution ambiguity: public fun Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier defined in root package public constructor Identifier(name: kotlin.String, myHasDollar: kotlin.Boolean) defined in Identifier
// ERROR: Overload resolution ambiguity: public fun Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier defined in root package public constructor Identifier(name: kotlin.String, myHasDollar: kotlin.Boolean) defined in Identifier
// ERROR: Overload resolution ambiguity: public fun Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier defined in root package public constructor Identifier(name: kotlin.String, myHasDollar: kotlin.Boolean) defined in Identifier
// ERROR: Overload resolution ambiguity: public fun Identifier(name: kotlin.String, isNullable: kotlin.Boolean): Identifier defined in root package public constructor Identifier(name: kotlin.String, myHasDollar: kotlin.Boolean) defined in Identifier
public fun Identifier(name: String): Identifier {
return Identifier(name, false)
}
public fun Identifier(name: String, isNullable: Boolean): Identifier {
val __ = Identifier(name, false)
__.myNullable = isNullable
return __
}
public fun Identifier(name: String, hasDollar: Boolean, isNullable: Boolean): Identifier {
val __ = Identifier(name, hasDollar)
__.myNullable = isNullable
return __
}
public class Identifier(public val name: String, private val myHasDollar: Boolean) {
private var myNullable = true
}
public class User {
class object {
public fun main() {
val i1 = Identifier("name", false, true)
val i2 = Identifier("name", false)
val i3 = Identifier("name")
}
}
}
@@ -0,0 +1,20 @@
class C {
private final int arg1;
private final int arg2;
private final int arg3;
int foo(int p){ return p; }
private static int staticFoo(int p){ return p; }
public static int staticFoo2(){ return 0; }
C(int arg1, int arg2, int arg3) {
this.arg1 = arg1;
this.arg2 = arg2;
this.arg3 = arg3;
}
C(int arg1, int arg2, C other) {
this(arg1, arg2, 0);
System.out.println(foo(1) + this.foo(2) + other.foo(3) + staticFoo(4) + C.staticFoo(5));
}
}
@@ -0,0 +1,24 @@
// ERROR: Cannot access 'staticFoo': it is 'private' in '<class-object-for-C>'
// ERROR: Cannot access 'staticFoo': it is 'private' in '<class-object-for-C>'
fun C(arg1: Int, arg2: Int, other: C): C {
val __ = C(arg1, arg2, 0)
System.out.println(__.foo(1) + __.foo(2) + other.foo(3) + C.staticFoo(4) + C.staticFoo(5))
return __
}
class C(private val arg1: Int, private val arg2: Int, private val arg3: Int) {
fun foo(p: Int): Int {
return p
}
class object {
private fun staticFoo(p: Int): Int {
return p
}
public fun staticFoo2(): Int {
return 0
}
}
}
@@ -0,0 +1,14 @@
class A {
A(Nested nested) {
}
A() {
this(new Nested(Nested.FIELD));
}
static class Nested {
Nested(int p){}
public static final int FIELD = 0;
}
}
@@ -0,0 +1,9 @@
class A(nested: A.Nested = A.Nested(A.Nested.FIELD)) {
class Nested(p: Int) {
class object {
public val FIELD: Int = 0
}
}
}
@@ -0,0 +1,20 @@
import A.Nested;
class A {
A(Nested nested) {
}
A() {
this(new Nested(Nested.FIELD));
}
static class Nested {
Nested(int p){}
public static final int FIELD = 0;
}
}
class B {
Nested nested;
}
@@ -0,0 +1,16 @@
// ERROR: Property must be initialized or be abstract
import A.Nested
class A(nested: Nested = Nested(Nested.FIELD)) {
class Nested(p: Int) {
class object {
public val FIELD: Int = 0
}
}
}
class B {
var nested: Nested
}
@@ -0,0 +1,22 @@
package pack;
import static pack.A.Nested;
class A {
A(Nested nested) {
}
A() {
this(new Nested(Nested.FIELD));
}
static class Nested {
Nested(int p){}
public static final int FIELD = 0;
}
}
class B {
Nested nested;
}
@@ -0,0 +1,18 @@
// ERROR: Property must be initialized or be abstract
package pack
import pack.A.Nested
class A(nested: Nested = Nested(Nested.FIELD)) {
class Nested(p: Int) {
class object {
public val FIELD: Int = 0
}
}
}
class B {
var nested: Nested
}
@@ -0,0 +1,22 @@
package pack;
import static pack.A.*;
class A {
A(Nested nested) {
}
A() {
this(new Nested(Nested.FIELD));
}
static class Nested {
Nested(int p){}
public static final int FIELD = 0;
}
}
class B {
Nested nested;
}
@@ -0,0 +1,18 @@
// ERROR: Property must be initialized or be abstract
package pack
import pack.A.*
class A(nested: Nested = Nested(Nested.FIELD)) {
class Nested(p: Int) {
class object {
public val FIELD: Int = 0
}
}
}
class B {
var nested: Nested
}
@@ -0,0 +1,15 @@
class Base {
Base(Nested nested){}
static class Nested {
Nested(int p){}
public static final int FIELD = 0;
}
}
class Derived extends Base {
Derived() {
super(new Nested(Nested.FIELD));
}
}
@@ -0,0 +1,11 @@
open class Base(nested: Base.Nested) {
class Nested(p: Int) {
class object {
public val FIELD: Int = 0
}
}
}
class Derived : Base(Base.Nested(Base.Nested.FIELD))
@@ -0,0 +1,21 @@
class C {
C(int arg1, int arg2, int arg3) {
}
C(int arg1, int arg2) {
this(arg1, arg2, 0);
System.out.println();
}
C(int arg) {
System.out.println(arg);
}
}
public class User {
public static void main() {
C c1 = new C(1, 2, 3);
C c2 = new C(5, 6);
C c3 = new C(7);
}
}
@@ -0,0 +1,27 @@
fun C(arg1: Int, arg2: Int, arg3: Int): C {
return C()
}
fun C(arg1: Int, arg2: Int): C {
val __ = C(arg1, arg2, 0)
System.out.println()
return __
}
fun C(arg: Int): C {
val __ = C()
System.out.println(arg)
return __
}
class C
public class User {
class object {
public fun main() {
val c1 = C(1, 2, 3)
val c2 = C(5, 6)
val c3 = C(7)
}
}
}
@@ -0,0 +1,18 @@
package pack
class C {
C(int a, int b, int c, int d, int e) {
}
C(int a, int b, int c) {
this(a, b, c, 0, 0);
}
C(int a) {
this(a, 0, 0, 0, 1);
}
C() {
this(0, 0, 0, 0, 0);
}
}
@@ -0,0 +1,8 @@
package pack
fun C(a: Int): C {
return C(a, 0, 0, 0, 1)
}
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0)
@@ -0,0 +1,18 @@
package pack
class C {
C(int a, int b, int c, int d, int e) {
}
C(int a1, int b1, int c1) {
this(a1, b1, c1, 0, 0);
}
C(byte b) {
this(b, 0, 0, 0, 0);
}
C() {
this(0, 0, 0, 0, 0);
}
}
@@ -0,0 +1,12 @@
package pack
fun C(a1: Int, b1: Int, c1: Int): C {
return C(a1, b1, c1, 0, 0)
}
fun C(b: Byte): C {
return C(b.toInt(), 0, 0, 0, 0)
}
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0)
@@ -0,0 +1,14 @@
package pack
class C {
C(int a, int b, int c, int d, int e) {
}
C(int a, int b, int c) {
this(b, a, c, 0, 0);
}
C() {
this(0, 0, 0, 0, 0);
}
}
@@ -0,0 +1,8 @@
package pack
fun C(a: Int, b: Int, c: Int): C {
return C(b, a, c, 0, 0)
}
class C(a: Int = 0, b: Int = 0, c: Int = 0, d: Int = 0, e: Int = 0)
@@ -0,0 +1,22 @@
package pack
class C {
C(int a, int b, int c, int d, int e) {
}
C(int a, int b, int c) {
this(a, b, c, 4, 5);
}
C(int a) {
this(a, 2, 3);
}
C(int a, int b) {
this(a, b, 3, 4, 5);
}
C() {
this(1);
}
}
@@ -0,0 +1,3 @@
package pack
class C(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
@@ -0,0 +1,22 @@
package pack
class C {
C(int a, int b, int c, int d, int e) {
}
C() {
this(1);
}
C(int a, int b) {
this(a, b, 3, 4, 5);
}
C(int a) {
this(a, 2, 3);
}
C(int a, int b, int c) {
this(a, b, c, 4, 5);
}
}
@@ -0,0 +1,3 @@
package pack
class C(a: Int = 1, b: Int = 2, c: Int = 3, d: Int = 4, e: Int = 5)
@@ -0,0 +1,27 @@
class C {
private int field;
C(int arg1, int arg2, int arg3) {
arg1++;
System.out.print(arg1 + arg2);
field = arg3;
arg3++;
}
C(int arg1, int arg2) {
this(arg1, arg2, 0);
arg2++;
}
C(int arg1) {
this(arg1, 0, 0);
}
}
public class User {
public static void main() {
C c1 = new C(100, 100, 100);
C c2 = new C(100, 100);
C c3 = new C(100);
}
}
@@ -0,0 +1,30 @@
// ERROR: Overload resolution ambiguity: internal fun C(arg1: kotlin.Int, arg2: kotlin.Int): C defined in root package public constructor C(arg1: kotlin.Int, arg2: kotlin.Int = ..., arg3: kotlin.Int = ...) defined in C
fun C(arg1: Int, arg2: Int): C {
var arg2 = arg2
val __ = C(arg1, arg2, 0)
arg2++
return __
}
class C(arg1: Int, arg2: Int = 0, arg3: Int = 0) {
private val field: Int
{
var arg1 = arg1
var arg3 = arg3
arg1++
System.out.print(arg1 + arg2)
field = arg3
arg3++
}
}
public class User {
class object {
public fun main() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100)
val c3 = C(100)
}
}
}
@@ -0,0 +1,12 @@
class C {
private C(int arg1, int arg2, int arg3) {
}
private C(int arg1, int arg2) {
this(arg1, arg2, 0);
}
public C(int arg1) {
this(arg1, 0, 0);
}
}
@@ -0,0 +1,7 @@
// ERROR: Too many arguments for internal fun C(arg1: kotlin.Int): C defined in root package
// ERROR: Too many arguments for internal fun C(arg1: kotlin.Int): C defined in root package
fun C(arg1: Int): C {
return C(arg1, 0, 0)
}
class C private(arg1: Int, arg2: Int, arg3: Int = 0)
@@ -0,0 +1,23 @@
class C {
private final int arg1;
private final int arg2;
private final int arg3;
C(int arg1, int arg2, int arg3) {
this.arg1 = arg1;
this.arg2 = arg2;
this.arg3 = arg3;
}
C(int arg1, int arg2, C other) {
this(arg1, arg2, 0);
System.out.println(this.arg1 + other.arg2);
}
}
class User {
void foo() {
C c1 = new C(100, 100, 100);
C c2 = new C(100, 100, c1);
}
}
@@ -0,0 +1,16 @@
// ERROR: Cannot access 'arg1': it is 'private' in 'C'
// ERROR: Cannot access 'arg2': it is 'private' in 'C'
fun C(arg1: Int, arg2: Int, other: C): C {
val __ = C(arg1, arg2, 0)
System.out.println(__.arg1 + other.arg2)
return __
}
class C(private val arg1: Int, private val arg2: Int, private val arg3: Int)
class User {
fun foo() {
val c1 = C(100, 100, 100)
val c2 = C(100, 100, c1)
}
}
@@ -0,0 +1,73 @@
class Outer {
private class Inner1 {
public Inner1(){}
public Inner1(int a) {
this();
}
protected Inner1(char c) {
this();
}
private Inner1(boolean b) {
this();
}
}
protected class Inner2 {
public Inner2(){}
public Inner2(int a) {
this();
}
protected Inner2(char c) {
this();
}
private Inner2(boolean b) {
this();
}
}
class Inner3 {
public Inner3(){}
public Inner3(int a) {
this();
}
protected Inner3(char c) {
this();
}
private Inner3(boolean b) {
this();
}
}
public class Inner4 {
public Inner4(){}
public Inner4(int a) {
this();
}
protected Inner4(char c) {
this();
}
private Inner4(boolean b) {
this();
}
}
void foo() {
Inner1 inner1 = new Inner1(1);
Inner2 inner2 = new Inner2(2);
Inner3 inner3 = new Inner3(3);
Inner4 inner4 = new Inner4(4);
}
}
@@ -0,0 +1,68 @@
class Outer {
private fun Inner1(a: Int): Inner1 {
return Inner1()
}
private fun Inner1(c: Char): Inner1 {
return Inner1()
}
private fun Inner1(b: Boolean): Inner1 {
return Inner1()
}
private inner class Inner1
protected fun Inner2(a: Int): Inner2 {
return Inner2()
}
protected fun Inner2(c: Char): Inner2 {
return Inner2()
}
private fun Inner2(b: Boolean): Inner2 {
return Inner2()
}
protected inner class Inner2
fun Inner3(a: Int): Inner3 {
return Inner3()
}
fun Inner3(c: Char): Inner3 {
return Inner3()
}
private fun Inner3(b: Boolean): Inner3 {
return Inner3()
}
inner class Inner3
public fun Inner4(a: Int): Inner4 {
return Inner4()
}
public fun Inner4(c: Char): Inner4 {
return Inner4()
}
private fun Inner4(b: Boolean): Inner4 {
return Inner4()
}
public inner class Inner4
fun foo() {
val inner1 = Inner1(1)
val inner2 = Inner2(2)
val inner3 = Inner3(3)
val inner4 = Inner4(4)
}
}
@@ -0,0 +1,73 @@
class Outer {
private static class Nested1 {
public Nested1(){}
public Nested1(int a) {
this();
}
protected Nested1(char c) {
this();
}
private Nested1(boolean b) {
this();
}
}
protected static class Nested2 {
public Nested2(){}
public Nested2(int a) {
this();
}
protected Nested2(char c) {
this();
}
private Nested2(boolean b) {
this();
}
}
static class Nested3 {
public Nested3(){}
public Nested3(int a) {
this();
}
protected Nested3(char c) {
this();
}
private Nested3(boolean b) {
this();
}
}
public static class Nested4 {
public Nested4(){}
public Nested4(int a) {
this();
}
protected Nested4(char c) {
this();
}
private Nested4(boolean b) {
this();
}
}
static void foo() {
Nested1 nested1 = new Nested1(1);
Nested2 nested2 = new Nested2(2);
Nested3 nested3 = new Nested3(3);
Nested4 nested4 = new Nested4(4);
}
}
@@ -0,0 +1,70 @@
class Outer {
class object {
private fun Nested1(a: Int): Nested1 {
return Nested1()
}
private fun Nested1(c: Char): Nested1 {
return Nested1()
}
private fun Nested1(b: Boolean): Nested1 {
return Nested1()
}
private class Nested1
protected fun Nested2(a: Int): Nested2 {
return Nested2()
}
protected fun Nested2(c: Char): Nested2 {
return Nested2()
}
private fun Nested2(b: Boolean): Nested2 {
return Nested2()
}
protected class Nested2
fun Nested3(a: Int): Nested3 {
return Nested3()
}
fun Nested3(c: Char): Nested3 {
return Nested3()
}
private fun Nested3(b: Boolean): Nested3 {
return Nested3()
}
class Nested3
public fun Nested4(a: Int): Nested4 {
return Nested4()
}
public fun Nested4(c: Char): Nested4 {
return Nested4()
}
private fun Nested4(b: Boolean): Nested4 {
return Nested4()
}
public class Nested4
fun foo() {
val nested1 = Nested1(1)
val nested2 = Nested2(2)
val nested3 = Nested3(3)
val nested4 = Nested4(4)
}
}
}
@@ -0,0 +1,23 @@
class A {
public A() {}
public A(int a) { this(); }
protected A(char c) { this(); }
A(float f) { this(); }
private A(double d) { this(); }
}
public class B {
public B() {}
public B(int a) { this(); }
protected B(char c) { this(); }
B(float f) { this(); }
private B(double d) { this(); }
}
@@ -0,0 +1,36 @@
fun A(a: Int): A {
return A()
}
fun A(c: Char): A {
return A()
}
fun A(f: Float): A {
return A()
}
private fun A(d: Double): A {
return A()
}
class A
public fun B(a: Int): B {
return B()
}
public fun B(c: Char): B {
return B()
}
fun B(f: Float): B {
return B()
}
private fun B(d: Double): B {
return B()
}
public class B
@@ -0,0 +1,12 @@
class C {
private static int staticField1 = 0;
private static int staticField2 = 0;
C() {
}
C(int p) {
this();
System.out.println(staticField1 + C.staticField2);
}
}
@@ -0,0 +1,14 @@
// ERROR: Cannot access 'staticField1': it is 'private' in '<class-object-for-C>'
// ERROR: Cannot access 'staticField2': it is 'private' in '<class-object-for-C>'
fun C(p: Int): C {
val __ = C()
System.out.println(C.staticField1 + C.staticField2)
return __
}
class C {
class object {
private val staticField1 = 0
private val staticField2 = 0
}
}
@@ -0,0 +1,24 @@
public class Test {
private final String myName;
boolean a;
double b;
float c;
long d;
int e;
protected short f;
protected char g;
public Test() {}
public Test(String name) {
myName = foo(name);
}
static String foo(String n) {return "";}
}
public class User {
public static void main() {
Test t = new Test("name");
}
}
@@ -0,0 +1,37 @@
// ERROR: 'public fun Test(name: kotlin.String): Test' is already defined in root package
// ERROR: 'public constructor Test(myName: kotlin.String)' is already defined in root package
// ERROR: None of the following functions can be called with the arguments supplied: public fun Test(): Test defined in root package public fun Test(name: kotlin.String): Test defined in root package public constructor Test(myName: kotlin.String) defined in Test
// ERROR: Overload resolution ambiguity: public fun Test(name: kotlin.String): Test defined in root package public constructor Test(myName: kotlin.String) defined in Test
// ERROR: Overload resolution ambiguity: public fun Test(name: kotlin.String): Test defined in root package public constructor Test(myName: kotlin.String) defined in Test
public fun Test(): Test {
return Test(null)
}
public fun Test(name: String): Test {
return Test(Test.foo(name))
}
public class Test(private val myName: String) {
var a: Boolean = false
var b: Double = 0.toDouble()
var c: Float = 0.toFloat()
var d: Long = 0
var e: Int = 0
protected var f: Short = 0
protected var g: Char = ' '
class object {
fun foo(n: String): String {
return ""
}
}
}
public class User {
class object {
public fun main() {
val t = Test("name")
}
}
}