Merge branch 'master' into inline

This commit is contained in:
KonstantinAnisimov
2017-02-06 17:21:28 +07:00
committed by GitHub
51 changed files with 1155 additions and 243 deletions
@@ -0,0 +1,21 @@
open class Father(val param: String) {
abstract inner class InClass {
fun work(): String {
return param
}
}
inner class Child(p: String) : Father(p) {
inner class Child2 : Father.InClass {
constructor(): super()
}
}
}
fun box(): String {
return Father("fail").Child("OK").Child2().work()
}
fun main(args: Array<String>) {
println(box())
}
@@ -0,0 +1,13 @@
open class Outer(val outer: String) {
open inner class Inner(val inner: String): Outer(inner) {
fun foo() = outer
}
fun value() = Inner("OK").foo()
}
fun box() = Outer("Fail").value()
fun main(args : Array<String>) {
println(box())
}
@@ -0,0 +1,18 @@
fun box() {
var previous: Any? = null
for (i in 0 .. 2) {
class Outer {
inner class Inner {
override fun toString() = i.toString()
}
override fun toString() = Inner().toString()
}
if (previous != null) println(previous.toString())
previous = Outer()
}
}
fun main(args: Array<String>) {
box()
}
@@ -0,0 +1,13 @@
fun box(s: String): String {
class Local {
open inner class Inner() {
open fun result() = s
}
}
return Local().Inner().result()
}
fun main(args : Array<String>) {
println(box("OK"))
}
@@ -0,0 +1,15 @@
fun foo(s: String): String {
open class Local {
fun f() = s
}
open class Derived: Local() {
fun g() = f()
}
return Derived().g()
}
fun main(args: Array<String>) {
println(foo("OK"))
}
@@ -0,0 +1,25 @@
abstract class Father {
abstract inner class InClass {
abstract fun work(): String
}
}
class Child : Father() {
val ChildInClass : InClass
init {
ChildInClass = object : Father.InClass() {
override fun work(): String {
return "OK"
}
}
}
}
fun box(): String {
return Child().ChildInClass.work()
}
fun main(args: Array<String>) {
println(box())
}
@@ -0,0 +1,21 @@
abstract class Father {
abstract inner class InClass {
abstract fun work(): String
}
}
class Child : Father() {
val ChildInClass = object : Father.InClass() {
override fun work(): String {
return "OK"
}
}
}
fun box(): String {
return Child().ChildInClass.work()
}
fun main(args: Array<String>) {
println(box())
}