Initial commit
This commit is contained in:
commit
ecad035dca
2972 files changed
+211653
No files matched your search
@@ -0,0 +1,28 @@
|
||||
module com.example.OverriddenProperty
|
||||
|
||||
abstract class BaseClass {
|
||||
fixed bar: Listing<BaseBar> = new {
|
||||
new {
|
||||
prop1 = "hello"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
theClass: TheClass
|
||||
|
||||
class TheClass extends BaseClass {
|
||||
fixed bar: Listing<Bar> = new {
|
||||
new {
|
||||
prop1 = "hello"
|
||||
prop2 = "hello again"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open class BaseBar {
|
||||
prop1: String
|
||||
}
|
||||
|
||||
class Bar extends BaseBar {
|
||||
prop2: String
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
module com.example.PolymorphicLib
|
||||
|
||||
open class Airplane {
|
||||
name: String
|
||||
numSeats: Int
|
||||
}
|
||||
|
||||
class Jet extends Airplane {
|
||||
isSuperSonic: Boolean
|
||||
}
|
||||
|
||||
class Propeller extends Airplane {
|
||||
isTurboprop: Boolean
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/// Gets generated into a Kotlin via Gradle task `generateTestConfigClasses`.
|
||||
module com.example.PolymorphicModuleTest
|
||||
|
||||
import "PolymorphicLib.pkl"
|
||||
|
||||
abstract class Dessert
|
||||
|
||||
class Strudel extends Dessert {
|
||||
numberOfRolls: Int
|
||||
}
|
||||
|
||||
class TurkishDelight extends Dessert {
|
||||
isOfferedToEdmund: Boolean
|
||||
}
|
||||
|
||||
desserts: Listing<Dessert> = new {
|
||||
new Strudel { numberOfRolls = 3 }
|
||||
new TurkishDelight { isOfferedToEdmund = true }
|
||||
}
|
||||
|
||||
planes: Listing<PolymorphicLib.Airplane> = new {
|
||||
new PolymorphicLib.Jet { name = "Concorde"; numSeats = 128; isSuperSonic = true }
|
||||
new PolymorphicLib.Propeller { name = "Cessna 172"; numSeats = 4; isTurboprop = true }
|
||||
}
|
||||
Reference in new issue
Block a user