mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
Fix generic types
This commit is contained in:
parent
4ed8948e94
commit
bffecea0a1
@ -63,12 +63,12 @@ public open class ExtensionException : RuntimeException {
|
|||||||
public constructor(cause: Throwable?) : super(cause)
|
public constructor(cause: Throwable?) : super(cause)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal inline fun <T : Any> AbstractExtensionPoint<T>.withExtensions(block: T.() -> Unit) {
|
internal inline fun <T : Extension> AbstractExtensionPoint<out T>.withExtensions(block: T.() -> Unit) {
|
||||||
return withExtensions { _ -> block() }
|
return withExtensions { _ -> block() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@LowPriorityInOverloadResolution
|
@LowPriorityInOverloadResolution
|
||||||
internal inline fun <T : Any> AbstractExtensionPoint<T>.withExtensions(block: T.(plugin: Plugin) -> Unit) {
|
internal inline fun <T : Extension> AbstractExtensionPoint<out T>.withExtensions(block: T.(plugin: Plugin) -> Unit) {
|
||||||
contract {
|
contract {
|
||||||
callsInPlace(block)
|
callsInPlace(block)
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ internal inline fun <T : Any> AbstractExtensionPoint<T>.withExtensions(block: T.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal inline fun <T : Any, E> AbstractExtensionPoint<T>.foldExtensions(
|
internal inline fun <T : Extension, E> AbstractExtensionPoint<out T>.foldExtensions(
|
||||||
initial: E,
|
initial: E,
|
||||||
block: (acc: E, extension: T) -> E
|
block: (acc: E, extension: T) -> E
|
||||||
): E {
|
): E {
|
||||||
@ -99,7 +99,7 @@ internal inline fun <T : Any, E> AbstractExtensionPoint<T>.foldExtensions(
|
|||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <T : Any> AbstractExtensionPoint<T>.throwExtensionException(
|
internal fun <T : Extension> AbstractExtensionPoint<out T>.throwExtensionException(
|
||||||
extension: T,
|
extension: T,
|
||||||
plugin: Plugin,
|
plugin: Plugin,
|
||||||
throwable: Throwable
|
throwable: Throwable
|
||||||
@ -110,11 +110,9 @@ internal fun <T : Any> AbstractExtensionPoint<T>.throwExtensionException(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <T : Any> AbstractExtensionPoint<T>
|
internal inline fun <T : Extension> AbstractExtensionPoint<T>.useExtensions(block: (extension: T) -> Unit): Unit =
|
||||||
|
|
||||||
internal inline fun <T : Any> AbstractExtensionPoint<T>.useExtensions(block: (extension: T) -> Unit): Unit =
|
|
||||||
withExtensions(block)
|
withExtensions(block)
|
||||||
|
|
||||||
@LowPriorityInOverloadResolution
|
@LowPriorityInOverloadResolution
|
||||||
internal inline fun <T : Any> AbstractExtensionPoint<T>.useExtensions(block: (extension: T, plugin: Plugin) -> Unit): Unit =
|
internal inline fun <T : Extension> AbstractExtensionPoint<T>.useExtensions(block: (extension: T, plugin: Plugin) -> Unit): Unit =
|
||||||
withExtensions(block)
|
withExtensions(block)
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
package net.mamoe.mirai.console.permission
|
package net.mamoe.mirai.console.permission
|
||||||
|
|
||||||
|
import net.mamoe.mirai.console.extension.useExtensions
|
||||||
import net.mamoe.mirai.console.extensions.PermissionServiceProvider
|
import net.mamoe.mirai.console.extensions.PermissionServiceProvider
|
||||||
import net.mamoe.mirai.console.util.ConsoleExperimentalAPI
|
import net.mamoe.mirai.console.util.ConsoleExperimentalAPI
|
||||||
|
|
||||||
@ -16,4 +17,18 @@ import net.mamoe.mirai.console.util.ConsoleExperimentalAPI
|
|||||||
* [PermissionServiceProvider]
|
* [PermissionServiceProvider]
|
||||||
*/
|
*/
|
||||||
@ConsoleExperimentalAPI
|
@ConsoleExperimentalAPI
|
||||||
public interface PermissionService
|
public interface PermissionService {
|
||||||
|
|
||||||
|
|
||||||
|
public companion object : PermissionService {
|
||||||
|
private val instance by lazy {
|
||||||
|
PermissionServiceProvider.useExtensions { }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface proprietary
|
||||||
|
|
||||||
|
@ConsoleExperimentalAPI
|
||||||
|
public interface Permission
|
||||||
|
@ -11,7 +11,7 @@ kotlin {
|
|||||||
target.compilations.all {
|
target.compilations.all {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "1.8"
|
jvmTarget = "1.8"
|
||||||
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=enable"
|
freeCompilerArgs = freeCompilerArgs + "-Xjvm-default=all"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user