Skip to content

Fix macros with array parameters #4567

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

Merged
merged 2 commits into from
May 23, 2018

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented May 22, 2018

We have to convert names in the form scala.Int[] to [I, scala.Int[][] to [[I, java.lang.String[] to [Ljava.lang.String; and so on.

@nicolasstucki
Copy link
Contributor Author

@biboudis you will need this fix to be able to write the Stream.of[A](x: Array[A]) as a macro

Copy link
Contributor

@biboudis biboudis left a comment

Choose a reason for hiding this comment

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

LGTM, merge 💯

/** The `Class[_]` of a primitive value type name */
def valueTypeNameToJavaType(name: TypeName)(implicit ctx: Context): Option[Class[_]] =
valueTypeNamesToJavaType.get(if (name.firstPart eq nme.scala_) name.lastPart.toTypeName else name)
// /** The `Class[_]` of a primitive value type name */
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this should remain commented-out and not removed, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, in case we need it for something else again. It was really useful the first time.

@nicolasstucki nicolasstucki merged commit ba2eafc into scala:master May 23, 2018
@Blaisorblade Blaisorblade deleted the fix-macro-array-params branch May 24, 2018 11:30
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