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

surface (fix): Fixes #3418 Handle surface of List of generic tuples #3427

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

OndrejSpanel
Copy link
Contributor

Again starting with the test, passing in Scala 2

Let us see if I will be able to fix it, this time I am not yet sure where to start.

@OndrejSpanel
Copy link
Contributor Author

OndrejSpanel commented Feb 28, 2024

Logging output, with added logging of resolvedTypeArgs and few other expressions:

==== method args of wvlet.airframe.surface.i3418.A[Int]
=== val data: scala.List[scala.Tuple2[scala.Predef.String, P]] Flags.Param false
===  a.args List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),object Predef),type String), TypeRef(NoPrefix,type P))))
===  typeArgTable Map(P -> TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),class Int))
===  resolvedTypeArgs List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class scala)),object Predef),type String), TypeRef(NoPrefix,type P))))

The types need to be resolved recursively, so that type parameters are replaced even in inner types.

@OndrejSpanel
Copy link
Contributor Author

OndrejSpanel commented Feb 28, 2024

Working in the surface sources is a pleasure - they are well structured and logical. I hope my contributions are able to keep up with the level expected.

@OndrejSpanel OndrejSpanel marked this pull request as ready for review February 28, 2024 08:18
@xerial
Copy link
Member

xerial commented Feb 28, 2024

Thanks for the recent report and contributions! I'll take a look.

Here are some tips for writing Scala 3 macros; I often check Dotty's source code https://github.com/lampepfl/dotty/blob/main/library/src/scala/quoted/Quotes.scala and look at xxxMethods extensions to understand what methods are available.

@xerial xerial changed the title Handle surface of List of generic tuples #3418 surface (fix): Fixes #3418 Handle surface of List of generic tuples Feb 28, 2024
@xerial xerial added the bug label Feb 28, 2024
@xerial xerial merged commit a7a8828 into wvlet:main Feb 28, 2024
15 checks passed
@OndrejSpanel OndrejSpanel deleted the generic-tuples-3418 branch February 29, 2024 06:57
@OndrejSpanel
Copy link
Contributor Author

@xerial Thanks for reviewing and merging. Would it be possible to publish the library with the current fixes, please?

I think all issues which were blocking my app port to Scala 3 should be resolved by now, other issues are non-blockers for me and can wait, but those until now made my app unusable (critical parts not compiling).

@xerial
Copy link
Member

xerial commented Mar 1, 2024

No problem. The release process is fully-aumoated, so 24.3.0 will be available soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants