mirror of
https://github.com/corda/corda.git
synced 2024-12-24 07:06:44 +00:00
Universal: fixed syntax issue that should have resulted in compile error
This commit is contained in:
parent
9c5ef6cdfe
commit
2299b3beae
@ -90,6 +90,14 @@ open class ContractBuilder {
|
||||
fun <T> String.givenThat(@Suppress("UNUSED_PARAMETER") ignore1: T, @Suppress("UNUSED_PARAMETER") ignore2: T) {
|
||||
}
|
||||
|
||||
@Deprecated(level = DeprecationLevel.ERROR, message = "Not available")
|
||||
fun Party.may(init: ActionBuilder.() -> Action) {
|
||||
}
|
||||
|
||||
@Deprecated(level = DeprecationLevel.ERROR, message = "Not available")
|
||||
fun Set<Party>.may(init: ActionBuilder.() -> Action) {
|
||||
}
|
||||
|
||||
/* fun Party.gives(beneficiary: Party, amount: Perceivable<Long>, currency: Currency) {
|
||||
contracts.add( Transfer(amount, currency, this, beneficiary))
|
||||
}*/
|
||||
|
@ -64,6 +64,7 @@ class ContractDefinition {
|
||||
actions {
|
||||
acmeCorp.may {
|
||||
"exercise".anytime {
|
||||
actions {
|
||||
(acmeCorp or highStreetBank).may {
|
||||
"execute".givenThat(after("2017-09-01")) {
|
||||
highStreetBank.gives(acmeCorp, 1.M, EUR)
|
||||
@ -72,6 +73,7 @@ class ContractDefinition {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
highStreetBank.may {
|
||||
"expire".givenThat(after("2017-09-01")) {
|
||||
zero
|
||||
@ -81,8 +83,52 @@ class ContractDefinition {
|
||||
}
|
||||
|
||||
|
||||
/* @Test
|
||||
fun `builder problem - should not compile`() {
|
||||
val arr = arrange {
|
||||
actions {
|
||||
acmeCorp.may {
|
||||
"execute".anytime {
|
||||
acmeCorp.may {
|
||||
"problem".anytime {
|
||||
highStreetBank.gives(acmeCorp, 1.M, USD)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert( arr is Actions )
|
||||
|
||||
if (arr is Actions) {
|
||||
assert( arr.actions.size == 1)
|
||||
}
|
||||
}
|
||||
*/
|
||||
@Test
|
||||
fun test() {
|
||||
fun `builder problem - legal`() {
|
||||
val arr = arrange {
|
||||
actions {
|
||||
acmeCorp.may {
|
||||
"execute".anytime {
|
||||
actions {
|
||||
acmeCorp.may {
|
||||
"problem".anytime {
|
||||
highStreetBank.gives(acmeCorp, 1.M, USD)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert( arr is Actions )
|
||||
|
||||
if (arr is Actions) {
|
||||
assert( arr.actions.size == 1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ class Swaption {
|
||||
"proceed".givenThat(after("01/07/2015")) {
|
||||
highStreetBank.gives(acmeCorp, libor(notional, "01/04/2015", "01/07/2015"), currency)
|
||||
acmeCorp.gives(highStreetBank, interest(notional, "act/365", coupon, "01/04/2015", "01/07/2015"), currency)
|
||||
actions {
|
||||
(highStreetBank or acmeCorp).may {
|
||||
"proceed".givenThat(after("01/10/2015")) {
|
||||
highStreetBank.gives(acmeCorp, libor(notional, "01/07/2015", "01/10/2015"), currency)
|
||||
@ -35,6 +36,7 @@ class Swaption {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
actions {
|
||||
acmeCorp.may {
|
||||
"cancel".anytime {
|
||||
|
Loading…
Reference in New Issue
Block a user