This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package kara.test | |
public enum class Shape(override val value: String) : EnumValues<Shape> { | |
circle: Shape("circle") | |
default: Shape("default") | |
poly: Shape("poly") | |
rect: Shape("rect") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class A | |
val A.name = "A" | |
class B: A() | |
val B.name = "B" | |
fun main(args: Array<String>) { | |
println(A().name) | |
println(B().name) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait A { | |
var foo: Int | |
} | |
var A.foo = 4 | |
class B: A // no impl foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class B { | |
val attr = Attr() | |
class Attr { | |
var name: String = "" | |
var width: Int = 0 | |
fun invoke(f: Attr.() -> Unit) { | |
this.f() | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class Attributes { | |
var name = "No name" | |
var time = "10:00" | |
} | |
class A { | |
val attr = object: Attributes() { | |
var href = "" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class Attributes { | |
var name = "No name" | |
var time = "10:00" | |
fun invoke(f : Attributes.() -> Unit) { | |
this.f() | |
} | |
} | |
class A { | |
class A_ATTR: Attributes() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Attributes<T> { | |
var name = "No name" | |
var time = "10:00" | |
fun invoke(f: T.() -> Unit) { | |
(this as T).f() | |
} | |
} | |
class CommonAttributes: Attributes<CommonAttributes>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val autocomplete = StrEnumAttribute("autocomplete", javaClass<Autocomplete>()) | |
public class Autocomplete(override val value: String): StrEnumValues<Autocomplete> { | |
val off = Autocomplete("off") | |
val on = Autocomplete("on") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class A { | |
val c1 = 1 | |
} | |
class B: A() { | |
val c2 = 2 | |
} | |
open class C | |
open class D: C() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait I<T> { | |
public fun invoke(f: T.() -> Unit) {} | |
} | |
open class A: I<A> { | |
val c1 = 1 | |
} | |
class B: I<B> { |
OlderNewer