diff options
Diffstat (limited to 'odcsim-core/src/main')
| -rw-r--r-- | odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorContext.kt | 8 | ||||
| -rw-r--r-- | odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorRef.kt | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorContext.kt b/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorContext.kt index f8128490..dc6ca7ec 100644 --- a/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorContext.kt +++ b/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorContext.kt @@ -165,3 +165,11 @@ interface ActorContext<T : Any> { */ fun isSync(target: ActorRef<*>): Boolean } + +/** + * Unsafe helper method for widening the type accepted by this [ActorContext]. + */ +fun <U : Any, T : U> ActorContext<T>.unsafeCast(): ActorContext<U> { + @Suppress("UNCHECKED_CAST") + return this as ActorContext<U> +} diff --git a/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorRef.kt b/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorRef.kt index 251d0669..45fc756e 100644 --- a/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorRef.kt +++ b/odcsim-core/src/main/kotlin/com/atlarge/odcsim/ActorRef.kt @@ -44,7 +44,7 @@ interface ActorRef<in T : Any> : Comparable<ActorRef<*>>, Serializable { /** * Unsafe helper method for widening the type accepted by this [ActorRef]. */ -fun <U : Any, T : U> ActorRef<T>.unsafeUpcast(): ActorRef<U> { +fun <U : Any, T : U> ActorRef<T>.unsafeCast(): ActorRef<U> { @Suppress("UNCHECKED_CAST") return this as ActorRef<U> } |
