Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make error message for captured generic type parameters much more str… #1863

Merged
merged 1 commit into from Feb 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -99,6 +99,11 @@ internal expect fun KClass<*>.platformSpecificSerializerNotRegistered(): Nothing
@Suppress("UNCHECKED_CAST")
internal fun KType.kclass() = when (val t = classifier) {
is KClass<*> -> t
is KTypeParameter -> {
error("Captured type paramerer $t from generic non-reified function. " +
"Such functionality cannot be supported as $t is erased, either specify serializer explicitly or make " +
"calling function inline with reified $t")
}
else -> error("Only KClass supported as classifier, got $t")
} as KClass<Any>

Expand Down