Skip to content

Conversation

@nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Nov 16, 2020

This is replacement for Expr.asReflectTree (which replaced unseal). This version of the API aligns with Type.of, TypeRepr.of and TypeTree.of. By requiring the Tree or Term modules to do the transformation we can ensure that all uses of the reflection API have the qctx.reflect import or explicit path. This delimits in a clearer way where the reflect API is used.

Migration

val expr: Expr[Any] = ...
- val term: Term = expr.unseal
- val term: Term = expr.asReflectTree
+ val term: Term = Term.of(expr)

- val tree: Tree = expr.unseal
- val tree: Tree = expr.asReflectTree
+ val tree: Tree = Tree.of(expr)

val exprList: List[Expr[Any]] = ...
- exprList.map(_.unseal)
- exprList.map(_.asReflectTree)
+ exprList.map(Term.of)

This is replacement for `Expr.asReflectTree` (which replaced `unseal`). This version of the API aligns with `Type.of`, `TypeRepr.of` and `TypeTree.of`. By requiring the `Tree` or `Term` modules to do the transformation we can ensure that all uses of the reflection API have the `qctx.reflect` import or explicit path. This delimits in a clearer way where the reflect API is used.
@nicolasstucki nicolasstucki marked this pull request as ready for review November 16, 2020 11:55
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

@nicolasstucki nicolasstucki merged commit e893fc1 into scala:master Nov 16, 2020
@nicolasstucki nicolasstucki deleted the add-Tree.of branch November 16, 2020 13:38
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

3 participants