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

#patch Fix restriction on maps/collections nesting #309

Closed

Conversation

jschuchart-spot
Copy link
Contributor

@jschuchart-spot jschuchart-spot commented Jul 5, 2024

TL;DR

Removing the restriction on nesting depth for collections and maps

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

Removing the restriction on nesting depth for collections and maps. This simplifies the matching expression for SdkLiteralTypes.
This reuses the logic for creating TypeTags for a given type (-name) on the fly to make SdkLiteralTypes.of(...) recursive.

Tracking Issue

NA

Follow-up issue

NA

@@ -72,87 +73,17 @@ object SdkLiteralTypes {
blobs(BlobType.DEFAULT).asInstanceOf[SdkLiteralType[T]]
case t if t =:= typeOf[Binary] =>
binary().asInstanceOf[SdkLiteralType[T]]

case t if t <:< typeOf[List[Any]] =>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically, List[T] is also a Product, so I'm not sure how this match worked before

@@ -369,28 +301,6 @@ object SdkLiteralTypes {
}
}

def createTypeTag[U <: Product](tpe: Type): TypeTag[U] = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pulled out to further down, so it is accessible in .of()

Comment on lines 419 to 420
val typeRef =
universe.internal.typeRef(NoPrefix, typSym, tpe.typeArgs)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to add the tpe.typeArgs as the last argument instead of List.empty as it would otherwise create a type tag e.g. for List instead of List[String], which messes up the recursion

@jschuchart-spot jschuchart-spot marked this pull request as ready for review July 5, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants