This file contains hidden or 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(open val bar: Int = 5) { | |
| { | |
| println("A: " + bar) | |
| } | |
| } | |
| class B(override val bar: Int = 2) : A() { | |
| { | |
| println("B: " + bar) |
This file contains hidden or 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 TagAttributes | |
| var TagAttributes.id = "" | |
| class Tag<out T: TagAttributes>(val containingTag: Tag<TagAttributes>?, val t: T) { | |
| val attr: T = t | |
| fun attr(f: T.() -> Unit) { | |
| } | |
| } |
This file contains hidden or 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
| public final class Attrs<out T: HtmlTag>(tag: T): AbstractCommonAttribute<Attrs<T>>(tag) | |
| open class A(containingTag: HtmlBodyTag): AllowText, HtmlBodyTag(containingTag, "a") { | |
| // public final class Attrs(htmlTag: HtmlTag): AbstractCommonAttribute<Attrs>(htmlTag) | |
| public open val attr: Attrs<A> = Attrs(this) | |
| } | |
| public var Attrs<A>.href: Link by Attributes.href | |
| class A1: A("") { |
This file contains hidden or 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 { | |
| private fun foo() | |
| fun bar() { | |
| foo() | |
| } | |
| } | |
| class B: A {} | |
| fun main(args: Array<String>) { |
This file contains hidden or 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> { |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 = "" | |
| } | |
| } |